Vediamo se ho capito bene
codice:
Function StringType(stringa As String) As Integer
Dim numerico As Boolean
Dim alfabetico As Boolean
Dim altri As Boolean
For i = 1 To LCase(Len(stringa))
Select Case Asc(Mid(stringa, i, 1))
Case 97 To 122
alfabetico = True
Case 48 To 57
numerico = True
Case Else
altri = True
End Select
Next i
If altri = True Then
StringType = 4
Exit Function
End If
If numerico = True And alfabetico = False Then
StringType = 2
ElseIf numerico = False And alfabetico = True Then
StringType = 1
Else
StringType = 3
End If
End Function
Questa funzione DOVREBBE (non l'ho testata, l'ho scritta direttamente qui) restituirti:
- 1 = Stringa Alfabetica (A...Z / a...z)
- 2 = Stringa Numerica (0..9)
- 3 = Stringa Alfanumerica (A...Z / a...z / 0...9)
- 4 = Stringa contenente altri tipi di carettere