how i can take part of email address
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohamuud hassan
am 18 Mai 2015
Bearbeitet: per isakson
am 18 Mai 2015
hello all; if i want to take part of email address. for instance, baashe@hotmail.com, suppose i want after @, which means hotmail.com. help me to solve this
0 Kommentare
Akzeptierte Antwort
per isakson
am 18 Mai 2015
Bearbeitet: per isakson
am 18 Mai 2015
... and with regexp
>> regexp( 'baashe@hotmail.com', '(?<=@).+$', 'match' )
ans =
'hotmail.com'
0 Kommentare
Weitere Antworten (2)
Image Analyst
am 18 Mai 2015
Use strfind(). Be sure to make your code robust enough to handle missing @ symbols, and check if @ is in there with isempty.
email = 'baashe@hotmail.com'
atIndex = strfind(email, '@');
if ~isempty(atIndex)
% It's a valid address. Extract the domain.
domain = email(atIndex+1:end);
message = sprintf('The domain is %s', domain);
uiwait(helpdlg(message));
else
% Not a proper email address.
warningMessage = sprintf('%s is not a proper email address', email);
uiwait(warndlg(warningMessage));
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!