$SubRep: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Replace occurrences of string<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Replace occurrences of string<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubRep function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubRep function is the [[Replace (String function)]].</p>


This function replaces occurrences of a substring in one string with another.  
This function replaces occurrences of a substring in one string with another.  
Line 17: Line 17:


The fifth argument is a repeat count indicating the number of occurrences to be replaced. This is an optional argument, and it defaults to 1.
The fifth argument is a repeat count indicating the number of occurrences to be replaced. This is an optional argument, and it defaults to 1.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %STRING = $SubRep(string, substring, repstring, -
<p class="syntax"><section begin="syntax" /> %STRING = $SubRep(string, substring, repstring, -
Line 24: Line 25:
</p>
</p>
<p class="caption">%STRING is part of the first argument string.</p>
<p class="caption">%STRING is part of the first argument string.</p>
For example, this statement sets %JUNK to <tt>XYCDABAB</tt>:
For example, this statement sets %JUNK to <tt>XYCDABAB</tt>:
<p class="code"> %JUNK = $SubRep('ABCDABAB', 'AB', 'XY')
<p class="code"> %JUNK = $SubRep('ABCDABAB', 'AB', 'XY')
</p>
</p>


This statement sets %JUNK to <tt>XYCDXYXY</tt>:
This statement sets %JUNK to <tt>XYCDXYXY</tt>:
<p class="code"> %JUNK = $SubRep('ABCDABAB', 'AB', 'XY', ,5)
<p class="code"> %JUNK = $SubRep('ABCDABAB', 'AB', 'XY', ,5)
</p>
</p>


This statement sets %JUNK to <tt>ABCDXYXY</tt>.
This statement sets %JUNK to <tt>ABCDXYXY</tt>.
Line 38: Line 39:
</p>
</p>


If the substitution would cause the result value to exceed 255 characters, it is not performed.


If the substitution would cause the result value to exceed 255 characters, it is not performed.
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Sirius functions]]</li>
Line 49: Line 50:
<li>[[Japanese functions]]</li>
<li>[[Japanese functions]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
<p class="caption">Products authorizing $SubRep
<p class="caption">Products authorizing $SubRep
</p>
</p>


[[Category:$Functions|$SubRep]]
[[Category:$Functions|$SubRep]]

Revision as of 20:27, 8 February 2011

<section begin="desc" />Replace occurrences of string<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubRep function is the Replace (String function).

This function replaces occurrences of a substring in one string with another.

The $SubRep function accepts five arguments and returns a string result that is part of the first argument string.

The first argument is an arbitrary string.

The second argument is an arbitrary string located in argument 1.

The third argument is a replacement string.

The fourth argument is a starting position in the first argument string. This is an optional argument and defaults to 1.

The fifth argument is a repeat count indicating the number of occurrences to be replaced. This is an optional argument, and it defaults to 1.

Syntax

<section begin="syntax" /> %STRING = $SubRep(string, substring, repstring, - start_pos, count) <section end="syntax" />

$SubRep Function

%STRING is part of the first argument string.

For example, this statement sets %JUNK to XYCDABAB:

%JUNK = $SubRep('ABCDABAB', 'AB', 'XY')

This statement sets %JUNK to XYCDXYXY:

%JUNK = $SubRep('ABCDABAB', 'AB', 'XY', ,5)

This statement sets %JUNK to ABCDXYXY.

%JUNK = $SubRep('ABCDABAB', 'AB', 'XY', 3 ,5)

If the substitution would cause the result value to exceed 255 characters, it is not performed.

Products authorizing $SubRep