function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vibrationvibration 

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?

Pradeep_NavatarPradeep_Navatar

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

vibrationvibration

index bound error

 

AzarudeenAzarudeen

code is not worked plz help me