Page 1 of 1
Appending text to a string
Posted: Thu Sep 09, 2010 4:55 pm
by Susan Smith
Hi all,
Can someone point me to the spot in the wiki where it discusses appending text to the END of a string? I think that this is new with either 4.18 or 4.2, and I THOUGHT I saw it in the wiki at one point, but no search seems to take me there (I tried "assignment statements" and "LET", but that didn't help.)
I thought it was something like LET A$(X:0)="MORE STUFF". The 'zero" seemed significant, but I can't figure out the proper syntax. I see that let A$(0:0) will "pre-pend" the text to the beginning of the string, moving everything else over.
-- Susan
Posted: Thu Sep 09, 2010 5:32 pm
by gtisdale
To add to the end of a string simply
LET a$(inf:inf)="Stuff to append"
just like
LET a$(0:0)="Stuff to prepend"
FNGeorge
Posted: Thu Sep 09, 2010 5:49 pm
by Susan Smith
Thank you George, I would have never guessed about the "INF"
-- Susan
Posted: Fri Sep 10, 2010 6:40 am
by John
and if you look up the work "append" or "prepend" on the br wiki - you'll find the article.
Posted: Fri Sep 10, 2010 7:05 am
by John
interestingly enough I did a few speed test with the different methods over 99,000,000 cycles and the method:
x$(inf:0)='text to append'
and
x$(32767:0)='text to append'
we're exactly the same speed (2 minutes,4 seconds).
while
x$(inf:inf)='text to append'
was only slightly slower (2 min,7 seconds)
They're all good. Luis says that (32767:0) is more backwards compatible with older versions of BR!/WB.
I added the inf methods to the Append page on the wiki for future reference.
-John B.
Posted: Fri Sep 10, 2010 7:35 am
by Susan Smith
Thanks for adding this to the wiki John. But we might want to put a link to it on the "assignment" page. At the time I was searching, I didn't think of the terms PREPEND or APPEND. Perhaps some others wouldn't either. I was thinking that the LET statement (which has it's own page) was the most logical place for a reference to the append/prepend page.
Posted: Fri Sep 10, 2010 7:41 am
by John
I added a "See also: [[Append]]" to the "Let" page... "Assignment" currently isn't a page, but it should probably be a redirect to somewhere... you think to "Assignment Statements"? And do you think that that the "Append" page should be a member of the "category:Assignment Statements"? Currently I have only actual statements as members of that category and "Append" isn't a statement, it's currently a member of the categories "Basics" and "Terminology".
-John
Posted: Fri Sep 10, 2010 7:46 am
by Susan Smith
Oh, I'm sorry! I must have missed the "see also" on the LET page. It's great. That's exactly what I meant. No need to do anything further. Thanks John. Perfect.
-- Susan
Posted: Fri Sep 10, 2010 7:50 am
by John

hehehe - I
just added it... Actually I just made the whole "Let" article *much* longer by combining two seperate "Let" articles.