If you are removing one type of character, the replace method is best. If you want to remove multiple, I’d recommend using regex replace.
I’m assuming you want to keep all alphanumeric characters and remove the rest. UiPath has a built-in ‘Replace’ activity (UiPath.Core.Activities.Replace), otherwise you can do it in an assign as well with the System.Text.RegularExpressions.Regex.Replace method. I will assume you’re using the built-in activity - fill in the following properties:
Input: This is the string variable you want to clean-up.
Pattern: “[^a-zA-Z0-9]” - this pattern will match anything that is not an upper/lowercase character or a number
RegexOption: You can leave this alone with the default settings
Result: This is the output string that has been cleaned up. You can overwrite the same string variable you used as input, or use a completely different string variable, it’s completely up to you