removing alpha characters from string

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Is there any quick and easy (other then scanning a string char by char) to
remove all the alpha chars from a string and leave only numbers?

ex:

A12334234-3431AP

comes out to 123342343431
thanks!
 
Brian Henry said:
Is there any quick and easy (other then scanning a string char by char) to
remove all the alpha chars from a string and leave only numbers?

ex:

A12334234-3431AP

comes out to 123342343431

\\\
Imports System.Text.RegularExpressions
..
..
..
Dim s As String = "A23zb4-u98"
MsgBox(Regex.Replace(s, "[^0-9]", ""))
///
 
just use a regex that extracts only the numbers?

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top