$SubErs: Difference between revisions
Jump to navigation
Jump to search
(Automatically generated page update) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Remove occurrence of one string from another</span> | <span class="pageSubtitle">Remove occurrence of one string from another</span> | ||
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubErs function is the [[Remove (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 $SubErs function is the <var>[[Remove (String function)|Remove]]</var> function.</p> | ||
This function removes an occurrence of one string from another. | This function removes an occurrence of one string from another. | ||
Line 8: | Line 8: | ||
The <var>$SubErs</var> function accepts four arguments and returns a string result that is part of the first argument string. | The <var>$SubErs</var> function accepts four arguments and returns a string result that is part of the first argument string. | ||
==Syntax== | |||
<p class="syntax"><span class="term">%string</span> = <span class="literal">$SubErs</span>(<span class="term">string</span>, <span class="term">substring</span>, <span class="term">start_pos</span>, [<span class="term">count</span>]) | |||
</p> | |||
The | ===Syntax terms=== | ||
<table> | |||
<tr><th>%string</th> | |||
<td>The part of the <var class="term">string</var> argument that remains after <var class="term">substring</var> is removed from it.</td></tr> | |||
<tr><th>string</th> | |||
<td>An arbitrary string.</td></tr> | |||
<tr><th>substring</th> | |||
<td>Another arbitrary string. </td></tr> | |||
<tr><th>start_pos</th> | |||
< | <td>A starting position within <var class="term">string</var>. </td></tr> | ||
</ | |||
< | <tr><th>count</th> | ||
<td>A repeat count indicating the number of occurrences of <var class="term">substring</var> to be removed. This is an optional argument, and it defaults to 1.</td></tr> | |||
</table> | |||
==Examples== | ==Examples== | ||
Line 56: | Line 64: | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$SubErs]] | [[Category:$Functions|$SubErs]] |
Revision as of 21:40, 24 July 2013
Remove occurrence of one string from another
Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubErs function is the Remove function.
This function removes an occurrence of one string from another.
The $SubErs function accepts four arguments and returns a string result that is part of the first argument string.
Syntax
%string = $SubErs(string, substring, start_pos, [count])
Syntax terms
%string | The part of the string argument that remains after substring is removed from it. |
---|---|
string | An arbitrary string. |
substring | Another arbitrary string. |
start_pos | A starting position within string. |
count | A repeat count indicating the number of occurrences of substring to be removed. This is an optional argument, and it defaults to 1. |
Examples
- This statement sets %JUNK to CDABAB:
%JUNK = $SubErs('ABCDABAB', 'AB')
- This statement sets %JUNK to WE WAITED LONG ENOUGH:
%JUNK = $SubErs('WE HAVE WAITED LONG ENOUGH', 'HAVE ')
- This statement sets %JUNK to WE HAVE AITED LONG ENOUGH:
%JUNK = $SubErs('WE HAVE WAITED LONG ENOUGH', 'W', 5)
- This statement sets %JUNK to E HAVE AITED LONG ENOUGH:
%JUNK = $SubErs('WE HAVE WAITED LONG ENOUGH', 'W', 1, 5)