Insert (String function): Difference between revisions
m (1 revision) |
m (first pass, match syntax diagram to template and fix tags) |
||
Line 1: | Line 1: | ||
{{Template:String:Insert subtitle}} | {{Template:String:Insert subtitle}} | ||
<var>Insert</var> is an [[Intrinsic classes|intrinsic]] function that inserts an argument string inside the method object <var class="term">string</var>, starting before the specified position in the method object <var class="term">string</var>. | |||
starting before the specified position in the method object string. | |||
==Syntax== | ==Syntax== | ||
{{Template:String:Insert syntax}} | {{Template:String:Insert syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%string</th> | ||
<td>A string variable to receive the modified method object string. | <td>A string variable to receive the modified method object <var class="term">string</var>.</td></tr> | ||
<tr><th>string</th> | <tr><th><var class="term">string</var></th> | ||
<td>The input string | <td>The input string</td></tr> | ||
<tr><th> | <tr><th><var class="term">insrtString</var></th> | ||
<td>The byte number in the method object that is the starting point of the substring that is returned. </td></tr> | <td>The byte number in the method object that is the starting point of the substring that is returned. </td></tr> | ||
<tr><th> | <tr><th><var class="term">position</var></th> | ||
<td>The numeric value of the position in the method object string before which | <td>The numeric value of the position in the method object <var class="term">string</var> <b><i>before</i></b> which to insert <var class="term">insrtString</var>. The first character from the left in the method object is position 1. The value of <var class="term">position</var> must be between 1 and the number of characters in the method object <var class="term">string</var> plus one. An invalid position produces a request cancellation.</td></tr> | ||
</table> | </table> | ||
==Usage Notes== | |||
<ul><li><var>Insert</var> is available as of <var class="product">Sirius Mods</var> version 7.6.</ul> | |||
==Examples== | ==Examples== | ||
<ol><li>The following request contains four <var>Insert</var> method calls: | |||
The following request contains four <var>Insert</var> method calls: | <p class="code">begin | ||
<p class="code"> | printText {~} = {'':insert('xyz', 1)} | ||
printText {~} = {'ABC':insert('xyz', 3)} | |||
printText {~} = {'ABC':insert('xyz', 3)} | printText {~} = {'ABC':insert('xyz', 4)} | ||
printText {~} = {'ABC':insert('xyz', 4)} | printText {~} = {'ABC':insert('xyz', 5)} | ||
printText {~} = {'ABC':insert('xyz', 5)} | |||
End | End | ||
</p> | </p> | ||
The request result is: | The request result is: | ||
Line 38: | Line 37: | ||
function INSERT: insertion position greater than length | function INSERT: insertion position greater than length | ||
of input string plus one in line 5 | of input string plus one in line 5 | ||
</p></ol> | |||
==See also== | ==See also== | ||
{{Template:String:Insert footer}} | {{Template:String:Insert footer}} |
Revision as of 06:29, 31 January 2011
Insert argument string inside the method object string (String class)
Insert is an intrinsic function that inserts an argument string inside the method object string, starting before the specified position in the method object string.
Syntax
%outString = string:Insert( insertedString, position)
Syntax terms
%string | A string variable to receive the modified method object string. |
---|---|
string | The input string |
insrtString | The byte number in the method object that is the starting point of the substring that is returned. |
position | The numeric value of the position in the method object string before which to insert insrtString. The first character from the left in the method object is position 1. The value of position must be between 1 and the number of characters in the method object string plus one. An invalid position produces a request cancellation. |
Usage Notes
- Insert is available as of Sirius Mods version 7.6.
Examples
- The following request contains four Insert method calls:
begin printText {~} = {:insert('xyz', 1)} printText {~} = {'ABC':insert('xyz', 3)} printText {~} = {'ABC':insert('xyz', 4)} printText {~} = {'ABC':insert('xyz', 5)} End
The request result is:
:insert('xyz', 1) = xyz 'abc':insert('xyz', 3) = ABxyzC 'abc':insert('xyz', 4) = ABCxyz 'abc':insert('xyz', 5) = *** 1 CANCELLING REQUEST: MSIR.0750: Class STRING, function INSERT: insertion position greater than length of input string plus one in line 5