This post explains how to remove special characters from the string in Apex
Example:
String strText = 'Welcome - to! % $sale&sforce \\ /code # crack %';
strText = strText.replaceAll('[^a-zA-Z0-9\\s+]', '');
System.debug('strText ======> '+strText);
Result
Happy Learning!!!
How to handle this for all kinds of regional languages as well ? I mean if I want to remove any special characters in any String containing Regional Languages.
ReplyDeleteNice one! would you suggest this one to "clean" phone fields for example?
ReplyDelete