How to replace non-numeric characters in a text string?
Posted on 2004-04-03
In vb.net, I am importing a phone number text field, and I need to output it as a field of all numerics. Quite often the input will have hyphens that I need to eliminate, so I've been handling that with:
StrJ=StrJ.Replace("-", "") which works fine.
But now I find that all kinds of other stuff is coming in, such as parentheses, asterisks, extra spaces, and even letters. Is there an easy way to eliminate any and all characters that are not numeric? I need to have a clean output that is nothing but the digits in the phone number.