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
charan@appscharan@apps 

Country code from Mobile number

Can anyone help me how to get country code form mobile number.

 

 

for example:

 

Mobile number on contact is 911234567890

 

The country code here as 91.

 

I need a code that can remove all the last 10 digits of a mobile number and

returns me remaining digits in the number i.e Country code..

 

 

 

Thanks in Advance.

Devendra NataniDevendra Natani

 

String phone = '911234567890';
phone = phone.substring(0,2);
system.debug('country code:::::::'+phone);