Advertisement
6_2008-2009 String Manipulation #196427

Has... String Functions

This is a series of Has.. Codes. It will search a textbox for the following: Lowercase letter, Uppercase letters, Numeric Characters, and Accented Characters. So, if it has lowercase letters or something, it will display a message box. this is a good example of how to use for..next loops, ASCII codes and the Instr Function, then again, this might be a lousy example, you be the judge.

AI

Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Código fonte
original-source
Public Function HasUppercase(TextBox As Object)
For i = 65 To 90 'i equals every letter from "A" to "Z"
If InStr(TextBox.Text, Chr$(i)) Then MsgBox "Has Uppercase"
'Searches for letters A to Z (i), and if i is present, Display a box.
End Function
Public Function HasLowercase(TextBox As Object)
For i = 97 To 122 'i equals every letter from "a" to "z"
If InStr(TextBox.Text, Chr$(i)) Then MsgBox "Has Lowercase"
'Searches for letters a to z (i), and if i is present, Display a box.
Next i
End Function
Public Function HasNumeric(TextBox As Object)
For i = 0 To 9 'i equals every number from "0" to "9"
If InStr(TextBox.Text, i) Then MsgBox "Has Numeric"
'Searches for numbers 0 to 9 (i), and if i is present, Display a box.
Next i
End Function
Public Function HasAccentchars(TextBox As Object)
For i = 128 To 223 'i equals every character from "€" to "ß"
If InStr(TextBox.Text, Chr$(i)) Then MsgBox "Has Accented Characters"
'Searches for accent characters € to ß (i), and if i is present, Display a box.
Next i
End Function
Comentários originais (3)
Recuperado do Wayback Machine