高分算法求解(提取手机号码的智能算法)
大家可以把下面的代码复制到vb里面的代码窗口运行以下,我这个算法很愚蠢
提取出来的可以不是真正有用的手机号码,请大家帮助我想一个聪敏一点的算法
再给你一个限制的条件:被提取的字符串不会很长 最多“64154224,13916358862“21个长度 我的要求就是提出取注册用户电话号码里的有用手机号码,100分
Private Sub Form_Load()
MsgBox GetMobileno("65131300,13017256442")
Unload Me
End Sub
Function GetMobileno(Tel As String) As String
Dim Place(1 To 8) As Integer
Dim i As Integer
Place(1) = InStr(1, Tel, "130")
Place(2) = InStr(1, Tel, "131")
Place(3) = InStr(1, Tel, "133")
Place(4) = InStr(1, Tel, "135")
Place(5) = InStr(1, Tel, "136")
Place(6) = InStr(1, Tel, "137")
Place(7) = InStr(1, Tel, "138")
Place(8) = InStr(1, Tel, "139")
For i = 1 To 8
If Place(i) > 0 Then
GetMobileno = Mid(Tel, Place(i), 11)
End If
Next i
End Function