分割字符串,请教各位,谢谢!!!
我想取得字符串里面最后的数字(不包含夹在字符里面的数字)
4fdde3 分割后为 4fdde和3
fd3d33 分割后为 fd3d和33
rte43re433 分割后为 rte43re和433
谢谢!!!
[解决办法]
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
Dim s() As String = {"4fdde3", "fd3d33", "rte43re433"}
For Each i As String In s
Dim m As Match = Regex.Match(i, "(.+?)(\d+)")
Console.WriteLine("{0} 分割后为 {1} 和 {2}", i, m.Groups(1).Value, m.Groups(2).Value)
Next
End Sub
End Module
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
Dim s() As String = {"4fdde3", "fd3d33", "rte43re433"}
For Each i As String In s
Dim m As Match = Regex.Match(i, "(.+?)(\d+$)")
Console.WriteLine("{0} 分割后为 {1} 和 {2}", i, m.Groups(1).Value, m.Groups(2).Value)
Next
End Sub
End Module