Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] store text in array of lines
#6
My goal was to store a bunch of code as an array of lines - each array element would hold a line of code.

I accidentally found a very useful function to solve this problem Big Grin . See below

Code:
Copy      Help
;select all
'Ca         ;;highlight all

str htmltextboxsourcecode

htmltextboxsourcecode.getsel

clo

ARRAY(str) arrayoflines
int i = 0

For each line:
str s
str lines = htmltextboxsourcecode

arrayoflines.create(numlines(lines))

foreach s lines
    if(!s.len) continue
    arrayoflines[i] = s    
    out arrayoflines[i]
    i + 1 ;;increment count by 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)