Line 120 is due to the fast that strings are not 0 based index. So what would a$(0) be? Under SMSQ/E at least, print a$(0) in the above example would give "10" - which is the length of the string... Since this seems to be an unorthodox behaviour, it's no wonder Qlib balks at it.

Line 105 makes no sense to me, just what should one expect from that? (maybe the reversed string (2 to 4)???), this should probably raise an error, just like line 110 does.

line 115 results in an empty strin,g - there is nothing before 0, so nothing can be obtained. Again, this should probably raise an error.

Have fun


Some other anomalies

100 a$ = "1234567890"
105 b$ = a$(4 to 3): REMark This works
110 REMark c$ = a$(4 to 2): REMark This fails with an error.
115 c$ = a$( to 0) : REMark  no error returned
120 c$ = a$(0):    : REMark  no error returned  BUT ERROR IF QLIBERATED
125 pause:stop

The problem of slicing strings was already discused here many years ago. I think it was Marcel Kilgus who gave us some explanation.

François Van Emelen

QL-Users Mailing List

QL-Users Mailing List

Reply via email to