$SubIns: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle">Insert string inside another string</span>
<span class="pageSubtitle">Insert string inside another string</span>


<p class="warn"><b>Note: </b>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="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubIns function is <var>[[Insert (String function)|Insert]]</var>.</p>


This function inserts a string inside another.  
This function inserts a string inside another.  
Line 8: Line 8:
The <var>$SubIns</var> 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.
==Syntax==
<p class="syntax"><span class="term">%string</span> = <span class="literal">$SubIns</span>(<span class="term">string</span>, <span class="term">ins_string</span>, <span class="term">insert_pos</span>)
</p>


The second argument is another arbitrary string.  
===Syntax terms===
<table>
<tr><th>%string</th>
<td>The string result that is a combination of <var class="term">string</var> and <var class="term">ins_string</var>.</td></tr>


The third argument is an insertion position in the first argument string.
<tr><th>string</th>
<td>An arbitrary string. </td></tr>


==Syntax==
<tr><th>ins_string</th>
<p class="syntax"><span class="term">%STRING</span> = <span class="literal">$SubIns</span>(<span class="term">string</span>, <span class="term">ins_string</span>, <span class="term">insert_pos</span>)
<td>A string to be inserted in the <var class="term">string</var> value. </td></tr>
</p>
 
<p>
<tr><th>insert_pos</th>
</p>
<td>The insertion position in the <var class="term">string</var> argument string.</td></tr>
<p>%STRING is a string made up of ''string'' and ''ins_string''.</p>
</table>


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.  
==Usage notes==
<ul>
<li>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.  
</ul>


For example, this statement sets %JUNK to <tt>PAT STAMPER, TRADER HORSE</tt>:
==Examples==
<ol>
<li>This statement sets %JUNK to <code>PAT STAMPER, TRADER HORSE</code>:


<p class="code"> %JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE')
<p class="code">%JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE')
</p>
</p>


This statement sets %JUNK to <tt>PAT STAMPER, HORSE TRADER</tt>:
<li>This statement sets %JUNK to <code>PAT STAMPER, HORSE TRADER</code>:


<p class="code"> %JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 12)
<p class="code">%JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 12)
</p>
</p>


This statement sets %JUNK to <tt>PAT STAMPER, TRADER</tt>:
<li>This statement sets %JUNK to <code>PAT STAMPER, TRADER</code>:


<p class="code"> %JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 92)
<p class="code">%JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 92)
</p>
</p>


Line 49: Line 60:
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
<p>
 
</p>


[[Category:$Functions|$SubIns]]
[[Category:$Functions|$SubIns]]

Revision as of 21:53, 24 July 2013

Insert string inside another string

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubIns function is Insert.

This function inserts a string inside another.

The $SubIns function accepts three arguments and returns a string result.

Syntax

%string = $SubIns(string, ins_string, insert_pos)

Syntax terms

%string The string result that is a combination of string and ins_string.
string An arbitrary string.
ins_string A string to be inserted in the string value.
insert_pos The insertion position in the string argument string.

Usage notes

  • 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.

Examples

  1. This statement sets %JUNK to PAT STAMPER, TRADER HORSE:

    %JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE')

  2. This statement sets %JUNK to PAT STAMPER, HORSE TRADER:

    %JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 12)

  3. This statement sets %JUNK to PAT STAMPER, TRADER:

    %JUNK = $SubIns('PAT STAMPER, TRADER', ' HORSE', 92)

    Products authorizing $SubIns