I'm getting some weird results when using substr. Here's my test
program:
set S0,"Hello world"
print "Arg to Reverse: "
print S0
print "\n"
set S1,""
set S2,""
length I0,S0
dec I0
$loop: substr S2,S0,I0,1
print "string so far:"
print S1
print ", "
print S2
print "\n"
concat S1,S2
dec I0
ge I0,0,$loop
set S0,S1
end
Here's the output:
Arg to Reverse: Hello world
string so far:d, d
string so far:l, l
string so far:r, r
string so far:o, o
string so far:w, w
string so far: ,
string so far:o, o
string so far:l, l
string so far:l, l
string so far:e, e
string so far:H, H
Why is S1 set on the first iteration, before the concat?
Brian