Android Question Extract Number from alphanumeric string

emexes

Expert
Licensed User
https://regex101.com/ is good for exploring regular expressions (and for building them, too ;-) eg:

upload_2019-6-6_0-57-48.png
 
Upvote 0

trepdas

Active Member
Licensed User
Longtime User
B4X:
Dim s As String = "AND051"
Dim m As Matcher = Regex.Matcher("\d+", s)
If m.Find Then
   Dim number As Int = m.Match
   Log(number)
End If


How would I delete the numbers from the strings and keep only the "AND" ?
B4X:
oldstring = "AND051"
newstring = "AND"
 
Upvote 0
Top