Remove special characters from string apex

Remove special characters from string apex




Question :

I need the RegEX to remove all special characters and spaces (833) 400-0032, 
I want to be 8334000032

Answer :

replaceAll('\\D','');

This will remove anything that is not a digit from the phone number.



Remove special characters from string apex Remove special characters from string apex Reviewed by dasfrogpractice on 22:38 Rating: 5

No comments:

Theme images by mariusFM77. Powered by Blogger.
Youtube Channel Image
Dasfrog Subscribe To watch more Salesforce Training
Subscribe