What's the best way to remove letters and special characters from a string?

Hi,

I’m trying to remove letters and other special characters from a string but I’m not finding the best way to do it. I’ve tried the Replace function but it only works with a single character at a time or a complete string.

What I’m trying to accomplish is to only keep the digits on the string, for example, If the user writes ‘123M€’, I want to get the ‘123’, so I can make some math with it later.

Thank you!

1 Like

I don’t think there’s a fancy filter. You could break it into an array, and remove the bad ones as you append it back into a string

Thank you for your response! :slight_smile:

I’m not sure I understand you right, this is what I tried to do:

On my ‘Value 1’ I have the string ‘123M€’
On my ‘Characters to remove’ I have the string ‘abcdefghijklmnopqrstuvwxyz€$%’

I’m sure I’m doing it wrong cause it’s not working…

2 Likes

Thank you, it worked perfectly!

1 Like