theguy0000 Posted January 21, 2006 Share Posted January 21, 2006 (edited) expandcollapse popup$str1 = "hello" $str2 = "he11o2" $str3 = "123" $str4 = "#123" $str5 = "&hello" If _AlphaNum($str1) Then MsgBox (0, "test", $str1 & " is Alphanumeric.") Else MsgBox (0, "test", $str1 & " is not alphanumeric.") EndIf If _AlphaNum($str2) Then MsgBox (0, "test", $str2 & " is Alphanumeric.") Else MsgBox (0, "test", $str2 & " is not alphanumeric.") EndIf If _AlphaNum($str3) Then MsgBox (0, "test", $str3 & " is Alphanumeric.") Else MsgBox (0, "test", $str3 & " is not alphanumeric.") EndIf If _AlphaNum($str4) Then MsgBox (0, "test", $str4 & " is Alphanumeric.") Else MsgBox (0, "test", $str4 & " is not alphanumeric.") EndIf If _AlphaNum($str5) Then MsgBox (0, "test", $str5 & " is Alphanumeric.") Else MsgBox (0, "test", $str5 & " is not alphanumeric.") EndIf Func _AlphaNum($s_string) If Not StringRegExp($s_string, "[^:alnum]", 0) Then Return 0 Return 1 EndFunc Func _URLEncode ($s_url) $s_url = String($s_url) $s_encoded = "" $as_url = StringSplit ($s_url, "") For $i=1 To $as_url[0] If StringInStr ( "?", $s_encoded ) Then If $as_url[$i] <> "&" Then If Not _AlphaNum ($as_url[$i]) Then $as_url[$i] = "%" & Asc($as_url[$i]) EndIf EndIf If $as_url[$i] = " " Then $as_url[$i] = "%20" $s_encoded &= $as_url[$1] Next Return $s_encoded EndFuncThe MsgBoxes say that every string is alphanumeric, including "#123" and "&hello"What is wrong here?Matt Edited January 21, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Share Posted January 21, 2006 Func _AlphaNum($s_string) If StringRegExp($s_string, "[^:alnum:]", 0) Then Return 0 Return 1 EndFunc Got rid of Not, and put : at the end of alnum. Link to comment Share on other sites More sharing options...
theguy0000 Posted January 21, 2006 Author Share Posted January 21, 2006 aha. thanks. Matt The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 21, 2006 Moderators Share Posted January 21, 2006 Um... what's wrong with StringIsAlNum()?$a = '#123' $b = '123' If StringIsAlNum($a) Then MsgBox(0, $a, 'String is AlphaNum') If StringIsAlNum($b) Then MsgBox(0, $b, 'String is AlphaNum') Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
theguy0000 Posted January 21, 2006 Author Share Posted January 21, 2006 (edited) oh I didnt even notice that :"> Matt Edited January 21, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now