|
|
Очистка строки от всех символов кроме ЦИФР
Public Function CleanPhone(vAnyValue As Variant) As String
Dim iPos As Integer, iStrLen As Integer, sTemp As String
On Error GoTo CleanPhone_Err
iStrLen = Len(vAnyValue & "")
If iStrLen = 0 Then
CleanPhone = "-"
GoTo CleanPhone_Bye
End If
For iPos = 1 To iStrLen
sTemp = Mid(vAnyValue, iPos, 1)
If IsNumeric(sTemp) Then
CleanPhone = CleanPhone & sTemp
End If
Next iPos
CleanPhone_Bye:
Exit Function
CleanPhone_Err:
CleanPhone = "Err: " & Err.Number
Err.Clear: Resume CleanPhone_Bye
End Function
|
|