Jump to content

About the non identical character Question


youtuber
 Share

Recommended Posts

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
Link to comment
Share on other sites

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 

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

Link to comment
Share on other sites

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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