Mr.wong crawl town, jiading district, Shanghai 15021920000 123 Lou zhu highway LouNa
Description
Phone number is not fixed, my personal ideas to find a set of 11 digit Numbers can be concluded that the phone
CodePudding user response:
General advice is a regular expression, but personally, I don't like
Option Explicit
Private Sub Command1_Click ()
MsgBox getPhoneNum (" 123 mr.wong crawl town, jiading district, Shanghai 15021920000 Lou zhu highway LouNa ")
End Sub
Private Function getPhoneNum (ByVal strin As String) As String
Dim As Integer I
Dim STRTMP As String
For I=1 To Len (strin) - 11
STRTMP=Mid (strin, I, 11)
If IsNumeric (STRTMP) And Left (STRTMP, 1)="1" Then
GetPhoneNum=STRTMP
The Exit Function
End the If
Next
End the Function