Jump to content

Recommended Posts

Posted

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]

Posted (edited)

$_String1 = 'blah blah'

$_String2 = 'blah blah'

If $_String1 = $_String2 Then ConsoleWrite ( "strings are same" & @Crlf )

; use == for case sensitive

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted

I am an Idiot :).... i was thinking just all about but not this one :mellow:...

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]

Posted

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...:mellow:

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...