用正则,参考下面的代码
For Each dr As DataRow In DataTables("表A").Select("型号 is not null")
Dim data As String = dr("型号")
Dim reg As new System.Text.RegularExpressions.Regex("([0-9]+)([a-zA-Z]+)")
Dim mc As object = reg.Matches(data)
If mc.count = 1 Then
dr("编号") = mc(0).groups(1).value
Dim code As String = mc(0).groups(2).value
dr("客户") = code.Substring(0, code.length-1)
dr("类別") = code.Substring(code.length-1)
Else
reg = new System.Text.RegularExpressions.Regex("([a-zA-Z]+)([0-9]+)")
mc = reg.Matches(data)
If mc.count = 1 Then
dr("编号") = mc(0).groups(2).value
Dim code As String = mc(0).groups(1).value
dr("客户") = code.Substring(0, code.length-1)
dr("类別") = code.Substring(code.length-1)
End If
End If
Next