【文件属性】:
文件名称:VB.net 获取电话号码的函数
文件大小:802B
文件格式:TXT
更新时间:2014-01-26 07:57:28
获取电话号码
Private Function GetPhoneNum(ByVal phone As String) As String
Dim result As String = ""
Dim temp As String
Dim temp2 As String
If phone = "" Then
result = phone
Else
If InStr(1, phone, Chr(10)) <> 0 Then
temp = Left(phone, InStr(phone, Chr(10)) - 1)
temp2 = Right(phone, Len(phone) - InStr(phone, Chr(10)))
temp2 = Replace(temp2, "0", "#")
temp2 = "(##)" + temp2
result = System.String.Format("{0:" + temp2 + "}", CDbl(Right(temp, Len(temp) - 1)))
Else
result = "(" + Left(phone, 3) + ")" + Right(phone, Len(phone) - 3)
End If
End If
Return result
End Function