Thanks so much for this. Works perfectly, However tried to use this on another list and it displays the 0 values too, how would I be specific to say >0 please
Without knowing exactly what is in your list, it's a bit hard to say. Is the list Strings, including "" and "0"? Or is it mostly Ints but sometimes nuls?
Anyway, maybe something like this:
B4X:
For I = 0 To VList.Size - 1
Dim Obj As Object = VList.Get(I)) 'could be Int, could be String, could be Null...
If Obj Is Int Then
Log(I & Tab & Obj)
End If
Next
or maybe a snipped out of this:
B4X:
Dim L As List
L.Initialize
For I = 1 To 50
If Rnd(0, 2) = 0 Then
L.Add("")
else if Rnd(0, 2) = 0 Then
L.Add(0)
Else
L.Add(Rnd(1, 10))
End If
Next
Log(L.Size)
Log(L)
Dim sb As StringBuilder
sb.Initialize
Dim Count As Int = 0
For I = 0 To L.Size - 1
Dim Obj As Object = L.Get(I) 'could be Int, could be String, could be Null...
If Obj Is Int Then
If Obj > 0 Then
If Count > 0 Then
sb.Append(",") 'add separator if needed
End If
Count = Count + 1
sb.Append(Obj)
End If
End If
Next
Log(sb.ToString)
Dim Count As Int = 0
For I = 0 To L.Size - 1
Dim Obj As Object = L.Get(I)
If Obj Is Int Then
If Obj > 0 Then
Count = Count + 1
Log(I & TAB & Count & TAB & Obj)
End If
End If
Next