$SubIns: Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Insert string inside another string</span> | <span class="pageSubtitle">Insert string inside another string</span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubIns function is the [[Insert (String function)]].</p> | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the <var>$SubIns</var> function is the [[Insert (String function)]].</p> | ||
This function inserts a string inside another. | This function inserts a string inside another. | ||
The $SubIns function accepts three arguments and returns a string result. | The <var>$SubIns</var> function accepts three arguments and returns a string result. | ||
The first argument is an arbitrary string. | The first argument is an arbitrary string. |
Revision as of 01:18, 19 October 2012
Insert string inside another string
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubIns function is the Insert (String function).
This function inserts a string inside another.
The $SubIns function accepts three arguments and returns a string result.
The first argument is an arbitrary string.
The second argument is another arbitrary string.
The third argument is an insertion position in the first argument string.
Syntax
<section begin="syntax" /> %STRING = $SubIns(string, ins_string, insert_pos) <section end="syntax" />
If no insertion position is provided, the insertion string is appended to the end of the first input string. If the insertion point is past the first input string, the first input string is left unmodified.
For example, this statement sets %JUNK to PAT STAMPER, TRADER HORSE:
%JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE')
This statement sets %JUNK to PAT STAMPER, HORSE TRADER:
%JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 12)
This statement sets %JUNK to PAT STAMPER, TRADER:
%JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 92)