Remove Characters From A String

Remove Characters From A String

If you want to remove symbols from a string, for example these characters:

~`!@#$%^&*()+|{}[]<>/\?;:.,

Use the Replace() function. This example is with a string variable varString1:

Replace() can be nested so you can continually replace individual characters to something else. In this example, we start with replace(variables(‘varString1′),’~’,”) and then wrap another replace() for each symbol. We can replace with anything, but here we’re replacing each symbol with nothing.

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(variables('varString1'),'~',''),'`',''),'!',''),'@',''),'#',''),'$',''),'%',''),'^',''),'&',''),'*',''),'(',''),')',''),'+',''),'|',''),'{',''),'}',''),'[',''),']',''),'<',''),'>',''),'/',''),'\',''),'?',''),';',''),':',''),'.',''),',','')