Insert (substring): Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(edit)
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
For disambiguation purposes, see also [[Insert (Config)]].
In BR, in order to insert one string into another, we must use the desired starting subscript and '''ZERO''' as the ending subscript:
In BR, in order to insert one string into another, we must use the desired starting subscript and '''ZERO''' as the ending subscript:


  00010 dim a$*255
  00010 dim a$*255
  00020 let a$ = "beginning end"
  00020 let a$ = "beginning end"
  00030 let a$(10:0) = " middle " ! here we are inserting 6 characters (" middle ") starting at character of string a$
  00030 let a$(10:0) = " middle " ! here we are inserting 6 characters (" middle ") starting at character 10 of string a$
  00040 print a$
  00040 print a$


'''Note''' that there is a difference between inserting characters and replacing characters in a string. When replacing, some characters from the original string are removed. When inserting, '''no characters from the original string are removed'''.
'''Note''' that there is a difference between inserting characters and replacing characters in a string. When replacing, some characters from the original string are removed. When inserting, '''no characters from the original string are removed'''.
<noinclude>
[[Category:Operations]]
[[Category:String Operations]]
</noinclude>

Latest revision as of 13:20, 14 October 2015

For disambiguation purposes, see also Insert (Config).

In BR, in order to insert one string into another, we must use the desired starting subscript and ZERO as the ending subscript:

00010 dim a$*255
00020 let a$ = "beginning end"
00030 let a$(10:0) = " middle " ! here we are inserting 6 characters (" middle ") starting at character 10 of string a$
00040 print a$

Note that there is a difference between inserting characters and replacing characters in a string. When replacing, some characters from the original string are removed. When inserting, no characters from the original string are removed.