Salut
en utilisant le regex
Imports System.Text.RegularExpressions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Function ExtractNumber(ByVal strin As String) As String
Dim newstr As String = String.Empty
Dim rg As New Regex("[0-9]")
Dim mac As MatchCollection = rg.Matches(strin)
For Each m As Match In mac
newstr &= m.Value
Next
Return newstr
End Function
Private Function ExtractLetters(ByVal strin As String) As String
Dim newstr As String = String.Empty
Dim rg As New Regex("[a-zA-Z]")
Dim mac As MatchCollection = rg.Matches(strin)
For Each m As Match In mac
newstr &= m.Value
Next
Return newstr
End Function |
Partager