How to remove numbers from a string?

Hello,

I have some text that may or may not have numbers in it. This text should be just a name so I want to know how can I remove any numbers from a string and leave just the name.
Thanks for the help!

Regards,

Alamyr

@Alamyr_Junior, you can use regex, for example this expression [^0-9\W]+ will ignore any numbers or characters and only get alphabets.

Capture

3 Likes

You can try this System.Text.RegularExpressions.Regex.Replace(your string,"[\d-]",String.empty)

4 Likes