|
-
Sep 21st, 2000, 04:19 AM
#1
Thread Starter
Conquistador
how do i check if something is alpha numeric?
-
Sep 21st, 2000, 04:39 AM
#2
transcendental analytic
Code:
'in declarations
option compare text
'the code
If Text like "[A-Z]" then...
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 21st, 2000, 05:47 PM
#3
Thread Starter
Conquistador
what wouldm happen if it was a number?
-
Sep 21st, 2000, 05:56 PM
#4
If it's like a number than you do this:
Code:
If Text Like "#" Then ...
-
Sep 21st, 2000, 05:56 PM
#5
try this function:
Code:
Public Function IsAlphaNumeric(ByVal sStr As String) As Boolean
Dim lPos As Long
Const ALPHA_NUM As String = "abcdefghijklmnopqrstuvwxyz" & _
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
lPos = StrSpn(StrPtr(sStr), StrPtr(ALPHA_NUM))
IsAlphaNumeric = (lPos = Len(sStr))
End Function
since it returns a boolean value, you can use it for validation. for example,
Code:
If IsAlphaNumeric(myTextBox.text) = true Then
msgbox "valid"
End If
hope this helps
-
Sep 21st, 2000, 08:06 PM
#6
Hyperactive Member
there is a vb function
IsNumeric which returns a bool.
ie
Code:
Dim MyVar, MyCheck
MyVar = "53" ' Assign value.
MyCheck = IsNumeric(MyVar) ' Returns True.
MyVar = "459.95" ' Assign value.
MyCheck = IsNumeric(MyVar) ' Returns True.
MyVar = "45 Help" ' Assign value.
MyCheck = IsNumeric(MyVar) ' Returns False.
not so good if its both... unless you cut it up, bit by bit. That could help.
-
Sep 22nd, 2000, 04:39 AM
#7
Thread Starter
Conquistador
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|