some array goodies
some features available only in thinbasic
Dim SomethingValue(500) As Long
SomethingValue(31)=31,32,33,34,35,36,37,38,39,40
the array from item 31 to 40 filled with these numbers
we can also use :
Array Assign SomethingValue(31)=31,32,33,34,35,36,37,38,39,40
Dim TextMatrix() As String 'dynamic string array
myText = "12_345_6789"
nLines = Parse(myText, TextMatrix, "_")
For i=1 To UBound(TextMatrix)
PrintL TextMatrix(i)
Next
the parse results fill the array items neatly without any extra code: note this :nLines = Parse(myText, TextMatrix, "_")
there are too many other goodies i will post from time to time
If you have other goodies about arrays you can add here
the complete example:
Uses "console"
Dim TextMatrix(), myText, nLines As String
Dim SomethingValue(500) As Long
Long i
SomethingValue(1)=1,2,3,4,5,6,7,8,9,10
SomethingValue(31)=31,32,33,34,35,36,37,38,39,40
Array Assign SomethingValue(401)=401,402,403,404,405
For i = 1 To 20
PrintL "index = "+Str$(i)+" "+SomethingValue(i)
Next
PrintL "******************************************"
For i = 31 To 40
PrintL "index = "+Str$(i)+" "+SomethingValue(i)
Next
PrintL "******************************************"
For i = 401 To 405
PrintL "index = "+Str$(i)+" "+SomethingValue(i)
Next
PrintL "******************************************"
myText = "12_345_6789"
nLines = Parse(myText, TextMatrix, "_")
For i=1 To UBound(TextMatrix)
PrintL TextMatrix(i)
Next
WaitKey
Bookmarks