Prepend: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(edit)
(edit)
 
Line 22: Line 22:


<noinclude>
<noinclude>
[[Category:Operators]]
[[Category:Operations]]
[[Category:String Operators]]
[[Category:String Operations]]
</noinclude>
</noinclude>

Latest revision as of 07:09, 11 January 2012

To prepend string1$ to string2$ means to join string1$ to the beginning of string2$.

To append to the beginning of a string you should use

X$(0:0)="append this to front"

or alternately

X$(1:0)="append this to front"

For example,

00010 dim result$*255 ! dimension long enough to fit the result
00020 let result$ = " and this is the end"
00030 let string_to_prepend$ = "this is the front"
00040 let result$(0:0) = string_to_prepend$
00050 print result$

The output of the program above will be:

this is the front and this is the end