+ Start a Discussion

how to split a company in email ID?

jEmail ID= Jaya@global.com


company name=global


How to split the global in the ID?


plz send code.

Tran ManTran Man

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