-3

I want to remove all special characters from a formula field called "ABC". Is there a way I could use one function that could remove all special characters or do I need to specify each special character in the substitute function?

Thanls

1

ya, unfortunately you will have to do it for each one of them. find and substitute functions should suffice your need.

| improve this answer | |
  • Looks to me like it provides an answer. It says to use find and substitute functions. I'm not going to comment on the quality of the answer, but it does, in fact, provide an answer. – DavidSchach Aug 21 '19 at 22:40
  • That is just an automated comment for review. The selection basically is meant to say "this content would be better posted as a comment". – Adrian Larson Aug 22 '19 at 4:45
0

Within the Apex String Class, there is the replaceAll function: replaceAll(regExp, replacement) replaces each substring of a string that matches the regular expression regExp with the replacement sequence replacement. Example:

String s1 = 'a b c 5 xyz';
String regExp = '[a-zA-Z]';
String replacement = '1';
String s2 = s1.replaceAll(regExp, replacement);
System.assertEquals('1 1 1 5 111', s2);

See https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm

But I think in a formula field there is only "Substitute" available. You can build complex logic here as well, see https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.