youtuber

About the non identical character Question

5 posts in this topic

#1 ·  Posted (edited)

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



stringcompare or just a straight comparison with ==

1 person likes this

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
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 

1 person likes this

Forum Rules         Procedure for posting code

Share this post


Link to post
Share on other sites

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

#5 ·  Posted (edited)

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
1 person likes this

Forum Rules         Procedure for posting code

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