I have data in list of arrays from loadCSV.
The data are intended to be bytes but are of course Strings.
I can access a single element and do a numerical calculation directly on one of the arrays in the list, i.e. add 3 and get the correct answer.
This led me to believe that some kind of auto casting is occuring.
Not so... I cannot store the numbers in an Byte or Int array.
Therefore the question is, how do I convert the original numbers entered in the csv file which then became strings but that act as numbers, back to Bytes?
I know that the answer is going to shock me.
[EDIT]
The data are intended to be bytes but are of course Strings.
I can access a single element and do a numerical calculation directly on one of the arrays in the list, i.e. add 3 and get the correct answer.
This led me to believe that some kind of auto casting is occuring.
Not so... I cannot store the numbers in an Byte or Int array.
Therefore the question is, how do I convert the original numbers entered in the csv file which then became strings but that act as numbers, back to Bytes?
I know that the answer is going to shock me.
[EDIT]
B4X:
Sub convCSV
Dim acsv(20,4) As String ' Byte ' Int
Dim su As StringUtils
Dim list1 As List
Dim i As Int
list1 = su.LoadCSV(File.DirAssets, "csv.txt", ",")
For i = 0 To list1.Size-1
Dim sCol() As String
sCol = list1.Get(i)
Log(sCol(11)*2) 'Calculation on string
' acsv(i,i Mod 4,0)=sCol
Next
End Sub
Last edited: