You are on page 1of 1

Function Limpia(cadena As String, Optional num_car_az As Byte = 1)

Dim pat As String


Select Case num_car_az
Case 2: pat = "[0-9]"
Case 3: pat = "[^a-z|ñ]"
Case Else: pat = "[^0-9]"
End Select
With CreateObject("vbscript.regexp")
.Global = True
.IgnoreCase = True
.Pattern = pat
Limpia = .Replace(cadena, "")
End With
If num_car_az = 1 Then
Limpia = CLng(Limpia)
end if
End Function

You might also like