There are several ways, including using a regular expression. You can also
do this:
Dim full As String = "jhg345gvbjk36hg53j5j3hg5j3"
Dim validChars As String = "0123456789"
Dim numbers As String
Dim allChars() As Char = full.ToCharArray
For Each ch As Char In allChars
If validChars.IndexOf(ch) <> -1 Then
numbers &= ch
End If
Next
Than I see a nice implementation given by Herfried from the Regex and than
you are not using it.
However he did not give you the complete reference that is needed.
\\\
Dim s As String = "&A$§23zb4-u9%%8Z"
MessageBox.Show(System.Text.RegularExpressions.Regex.Replace(s, "[^0-9]",
""))
///
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.