Matt @ MPCS Posted September 22, 2004 Share Posted September 22, 2004 I know all of the more advanced coders out there can write this on their own, but for those of you looking to compare strings taking into consideration letter case here is a little UDF to help. AutoIt: v3.0.103.0 Written by Matt Name: CompString() Parameters: String1, String2 Return: 1 if they are equal, -1 of not equal Func CompString( $String1, $String2 ) Local $i Local $StrVal1, $StrVal2 $StrVal1 = 0 $StrVal2 = 0 If( $String1 = $String2 ) Then For $i = 1 to StringLen( $String1 ) $StrVal1 = $StrVal1 + Asc( StringMid( $String1, $i, 1 ) ) Next For $i = 1 to StringLen( $String2 ) $StrVal2 = $StrVal2 + Asc( StringMid( $String2, $i, 1 ) ) Next If( $StrVal1 = $StrVal2 ) Then Return 1 EndIf EndIf Return -1 EndFunc I haven't seen anything else like this on the forum or in the documentation so I figured I would post it since it has worked really well for me. Always interested in questions, comments, bug reports. Thanks for your time. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
Valik Posted September 22, 2004 Share Posted September 22, 2004 Uhhh... open the help file, open the "Language Reference" 'folder' and choose "Operators". Then read the description for operator==. Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 22, 2004 Author Share Posted September 22, 2004 Thanks Valik... I was sure I missed it somewhere. It is already posted so if one of the admins wants to remove it that is fine. Most of the work I do isn't case sensitive so I hadnt run across that yet. Thanks for pointing that out though. *** Matt @ MPCS 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