Posts: 197
Threads: 60
Joined: Dec 2013
Hi,
I'd like to store some html into an array of lines, but I can't find anything to do that.
Is there such a function?
Alternatively, I thought I could loop through the text line by line and copy it to an array element.
Thanks.
Posts: 12,090
Threads: 142
Joined: Dec 2002
Macro
Macro2215
str s=
;one
;two
;three
ARRAY(str) a=s
Posts: 197
Threads: 60
Joined: Dec 2013
Thanks for the quick response.
It seems that I have to manually input the lines.
Here's some sample text that I would grab from an html source. I'm trying to put each of the four lines into an array element automatically, if possible..
<link href="assets/css/lib/bootstrap.css" rel="stylesheet">
<link href="assets/css/lib/bootstrap-responsive.css" rel="stylesheet">
<link href="assets/css/ur-extension.css" rel="stylesheet">
<link href="assets/css/ur.css" rel="stylesheet">
Thanks
Posts: 197
Threads: 60
Joined: Dec 2013
Hi Gintaras,
I haven't heard back so I'm following up. I would really appreciate your help. Thanks.
Posts: 12,090
Threads: 142
Joined: Dec 2002
If my code does not do what you need, please explain more, and give some your code to help to understand better.
Posts: 197
Threads: 60
Joined: Dec 2013
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
. See below
;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
Posts: 12,090
Threads: 142
Joined: Dec 2002
I think my code does the same.
Posts: 197
Threads: 60
Joined: Dec 2013
Your code does work. It looked to me that I had to declare each line manually in your example. Thanks for the elegant solution.