1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Function isAlphabetic(ByVal str As String, ignoreCase As Boolean) As BooleanDim stringOne As String
Dim regexOne As Object
Set regexOne = New RegExp
regexOne.Pattern = "^[a-z]+$"
regexOne.ignoreCase = ignoreCase
isalpha = regexOne.test(str)
End Function
Sub test()
Dim montableau As Variant
montableau = Array("A", "e", "5", "a2b", "Chien", "chat", "aze1", "aso?", "1234")
For Each el In montableau
Debug.Print el & " : " & isAlphabetic(el, False)
Next el
Debug.Print "=== Ignore Min/Maj ==="
For Each el In montableau
Debug.Print el & " : " & isAlphabetic(el, True)
Next el
End Sub |
Partager