You need to sign in to do that
Don't have an account?
RSK
How to remove special characters in a Sting
Hi, I need to remove special characters in a string ?, do we have any apex methods to remove spl characters ? Or any alternate solution ?.
Any help is highly appreciated.
Thanks In Advance,
Kumar
whats that string ?....
regards,
Kiran
String yourString = 'may the force be with @you^';
String specialChars = '&|^|@'; // in this string, write all the special chars you want to get ride of, pipe separated
for(integer i=0; i<specialChars.split('|').size(); i++)
yourString = yourString.replace(specialChars.split('|')[i], '');
System.debug('Special-chars free string is >>>>>>>>>>>>>>>>>>>>>>>>>>>>> ' + yourString);
Thanks for your response.
It works like a charm. But giving spaces between each and every character in the sting.
exp:
String : Jarocinie" Sp. z o.o.
Special-chars free string : J a r o c i n i e S p z o o
Regards,
Kumar
By
Anitha