$SubRep

From m204wiki
Revision as of 17:36, 28 January 2011 by 198.242.244.47 (talk) (Created page with "{{DISPLAYTITLE:$SubRep}} <span class="pageSubtitle"><section begin="desc" />Replace occurrences of string<section end="desc" /></span> <p class="warning">Most Sirius $functions ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<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 to be entered.

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