The following sample code works fine in B4A, but gives this error in B4i on line 2
Cannot cast type: {Type=String,Rank=1, RemoteObject=True} to: {Type=Object,Rank=1, RemoteObject=True}
Is there a way to write the IndexOf sub on B4i so that it can be type-agnostic?
Cannot cast type: {Type=String,Rank=1, RemoteObject=True} to: {Type=Object,Rank=1, RemoteObject=True}
B4X:
Private Sub TestIndex
IndexOf(Array As String("1", "2", "3"), "2")
End Sub
'index value in array
'-1 if not found
Public Sub IndexOf(values() As Object, value As Object) As Int
Dim rc As Int = -1
For i = 0 To values.Length - 1
If (values(i) = value) Then
rc = i
Exit
End If
Next
Return rc
End Sub
Is there a way to write the IndexOf sub on B4i so that it can be type-agnostic?