B4J Question Compare arrays

oldeast

Active Member
Licensed User
Longtime User
Hi all,
I am comparing two arrays, one created in code and the other is an array from an Excel header row (jPoi) in order to determine that the user has the right columns before data is imported.
The app compiles, no errors and when I log the two arrays by index they appear to match in the log, but I get don't get a pass for equality, what am I doing wrong?
Thanks.

B4X:
HdrList.Initialize
    HdrList.AddAll(Array As String("ObjName", "Accn", "PrimaryClass", "SecondClass", "DateMade", "Condition", "ConsDate", "Conservator"))

'load excel file

Dim lst1 As List
 lst1.Initialize
 lst1.AddAll(sheet.GetRow(0).Cells)

 For i=0 To 7
    If lst1.Get(i)  =   HdrList.Get(i) Then
        Log(lst1.Get(i))
        Log(HdrList.Get(i))
        Log("pass")
        Else
            Log("fail")
            Log(lst1.Get(i))
            Log(HdrList.Get(i))
        End If
Next

Log

Program started.
C:\Users\Graham\Downloads\SourceCode\B4J\Examples\Test\Files\Book1.xlsx
fail
ObjName
ObjName
fail
Accn1
Accn
fail
PrimaryClass
PrimaryClass
fail
SecondClass
SecondClass
fail
DateMade
DateMade
fail
Condition
Condition
fail
ConsDate
ConsDate
fail
Conservator
Conservator
 

eurojam

Well-Known Member
Licensed User
Longtime User
change this:
B4X:
...  
Dim s As String = lst1.Get(i)
    If  s =  HdrList.Get(i) Then
...
 
Upvote 0

oldeast

Active Member
Licensed User
Longtime User
Thanks very much Erel, such a great product and support, thank you very much.
Also Thanx eurojam for suggestion.
 
Upvote 0
Top