Ray,
Regex would probably work, but why not just use a simple loop?
String SomeString = "blah044954blah";
StringBuilder NewString = new StringBuilder();
for (int i = 0;i < SomeString.Length;i++)
{
if (!(((int) SomeString[i]) >= 48 || ((int) SomeString[i]) <= 57)) //
Assuming ASCII of course
{
NewString.Append(SomeString[i]);
}
}
SomeString = NewString.ToString();
This isn't the cleanest code, but it is fast.
Take care.
--
Nathan
"Ray Stevens" <nf*@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I would like to quickly strip out all non-numeric characters from a string
(including whitespace) into a new string (i.e., remove the edit mask).
Would
RegEx be the best way to do this and, if so, what is the syntax?