Results 1 to 10 of 25

Thread: some arrays goodies

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    some arrays goodies

    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
    
    Last edited by primo; 20-02-2017 at 17:30.

Similar Threads

  1. 3d arrays?
    By JosephE in forum thinDebug
    Replies: 2
    Last Post: 08-08-2010, 23:21
  2. Arrays
    By Charles Pegge in forum O2h Compiler
    Replies: 0
    Last Post: 17-03-2009, 16:09

Members who have read this thread: 3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •