Jump to content
youtuber

About the non identical character Question

Recommended Posts

youtuber

Hello how can I find if the word or sentence is not the same?

#include <Array.au3>
$a1[0] = "autoit0"
$a1[1] = "autoit0123asdf"
$a1[2] = "autoit0"
$a1[3] = "autoit0"
$a1[4] = "autoit0"

$b2[0] = "autoit0"
$b2[1] = "autoit0"
$b2[2] = "autoit0"
$b2[3] = "autoit0"
$b2[4] = "autoit0"



For $x = 0 To UBound($a1) - 1
    For $y = 0 To UBound($b2) - 1
        ConsoleWrite($a1[$x] & " " & $b2[$y] & @CRLF)
        If StringLen($a1[$x], $b2[$y]) <> Then
        ;If StringLen($a1[$x], $b2[$y]) Then
   ConsoleWrite($a1[$x] & " Characters are not the same " & $b2[$y] & @CRLF)
        EndIf
    Next
Next

 

Edited by youtuber

Share this post


Link to post
Share on other sites
kylomas

youtuber,

Assuming both arrays are the same length and you are comparing relative offsets one to one...

#include <Array.au3>

local $a1[5], $b2[5]

$a1[0] = "autoit0"
$a1[1] = "autoit0123asdf"
$a1[2] = "autoit0"
$a1[3] = "autoit0"
$a1[4] = "autoit0"

$b2[0] = "autoit0"
$b2[1] = "autoit0"
$b2[2] = "autoit0"
$b2[3] = "autoit0"
$b2[4] = "autoit0"



For $x = 0 To UBound($a1) - 1

    ConsoleWrite($a1[$x] & ' = ' & $b2[$x] & ($a1[$x] = $b2[$x] ? ' are ' : ' are not ') & ' equal'  & @CRLF)

Next

kylomas 

  • Like 1

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
youtuber

Thank you for your reply

How can I do it to use If Then instead of ConsoleWrite?

If $a1 AND $b2 == Then etc.

 

Share this post


Link to post
Share on other sites
kylomas

youtuber,

It has nothing to do with consolewrite.  I suspect you are asking for a translation of the ternary expression, like this?

#include <Array.au3>

local $a1[5], $b2[5]

$a1[0] = "autoit0"
$a1[1] = "autoit0123asdf"
$a1[2] = "autoit0"
$a1[3] = "autoit0"
$a1[4] = "autoit0"

$b2[0] = "autoit0"
$b2[1] = "autoit0"
$b2[2] = "autoit0"
$b2[3] = "autoit0"
$b2[4] = "autoit0"

For $x = 0 To UBound($a1) - 1

    if $a1[$x] = $b2[$x] then
        ConsoleWrite('equal' & @CRLF)
    Else
        ConsoleWrite('not equal' & @CRLF)
    endif

Next

kylomas

What do you mean by this?

If $a1 AND $b2 == Then

 

Edited by kylomas
question
  • Like 1

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.