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
Each item in lst1 is a PoiCell. It is not a string.
B4X:
If lst1.Size <> HdrList.Size Then Return False
For i = 0 To lst1.Size - 1
Dim pc As PoiCell = lst1.Get(i)
Dim s As String = HdrList.Get(i)
If pc.Value <> s Then
...
Else
...
End If
Next
While the above code can work properly it can also fail as it assumes that the automatic conversion of PoiCells to strings will always return the string value.