String email= 'Jaya@global.com'; String[] strTemp=email.split('@'); // first split with @, you'll
get [jaya, global.com] in array String[] comp=strTemp.split('.'); // again split 2nd
element of array with dot(.) System.debug(comp[0]);
// It shows the compny name 'global' in debug log
I guess you want the email domain.
Any particular language you prefer?
Tryout the given code below :
String email= 'Jaya@global.com';
String[] strTemp=email.split('@'); // first split with @, you'll get [jaya, global.com] in array
String[] comp=strTemp.split('.'); // again split 2nd element of array with dot(.)
System.debug(comp[0]); // It shows the compny name 'global' in debug log
index bound error
code is not worked plz help me