Syed23 Posted August 6, 2011 Posted August 6, 2011 Hi All, I need a help on comparing 2 strings. I mean not comparing the length of the string the comparision should check whether both the strings are same or not? For Example, I have a file with 10 strings and now i am reading a registry and i want to compare that the string took from the registry and the string is there in the file are same. How can we do that ? Hope the StringCompare() function compares the length i may be wrong. which function will help for this? Please suggest me! Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
wakillon Posted August 6, 2011 Posted August 6, 2011 (edited) $_String1 = 'blah blah' $_String2 = 'blah blah' If $_String1 = $_String2 Then ConsoleWrite ( "strings are same" & @Crlf ) ; use == for case sensitive Edited August 6, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Syed23 Posted August 6, 2011 Author Posted August 6, 2011 I am an Idiot .... i was thinking just all about but not this one ... okay i gotta another question can you help me... i have 2 stringsss $str1 = "Output folder: C:\Program Files\AutoIt3\SciTE" $str2 = C:\Program Files\AutoIt3\SciTE" now i wanted to check that $str2 is there in str1 or not how to do that ? will stringinstr() function help? Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
wakillon Posted August 7, 2011 Posted August 7, 2011 yes $str1 = "Output folder: C:\Program Files\AutoIt3\SciTE" $str2 = "C:\Program Files\AutoIt3\SciTE" If StringInStr ( $str1, $str2 ) <> 0 Then ConsoleWrite ( "$str2 is a part of $str1" & @Crlf ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Syed23 Posted August 7, 2011 Author Posted August 7, 2011 yes $str1 = "Output folder: C:\Program Files\AutoIt3\SciTE" $str2 = "C:\Program Files\AutoIt3\SciTE" If StringInStr ( $str1, $str2 ) <> 0 Then ConsoleWrite ( "$str2 is a part of $str1" & @Crlf ) It works as i expected. Thanks a lot... Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
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