$DelCh: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Remove characters from string, compress and strip blanks<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Remove characters from string, compress and strip blanks<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DelCh function is [[ | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DelCh function is the [[Remove (String function)]].</p> | ||
This function removes specified characters from an input string and performs blank compression and stripping. | This function removes specified characters from an input string and performs blank compression and stripping. | ||
Line 15: | Line 15: | ||
The fourth argument is a number indicating the type of blank compression or stripping to be performed. Valid numbers and their meanings are: | The fourth argument is a number indicating the type of blank compression or stripping to be performed. Valid numbers and their meanings are: | ||
<li> | <ol> | ||
<li> | <li>delete the specified characters | ||
<li> | <li>delete the specified characters and strip leading and trailing blanks | ||
</ | <li>delete the specified characters, strip leading and trailing blanks and compress multiple blanks to a single blank. | ||
</ol> | |||
This is an optional argument and defaults to 1. | This is an optional argument and defaults to 1. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %STRING = $DelCh(string, chars, start_pos, option) | <p class="syntax"><section begin="syntax" /> %STRING = $DelCh(string, chars, start_pos, option) | ||
Line 28: | Line 30: | ||
</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, the following statement sets %JUNK to <tt>CD</tt>: | For example, the following statement sets %JUNK to <tt>CD</tt>: | ||
<p class="code"> %JUNK = $DelCh('ABCDAAAABAB', 'AB') | <p class="code"> %JUNK = $DelCh('ABCDAAAABAB', 'AB') | ||
</p> | </p> | ||
This statement sets %JUNK to <tt>W HAV WAITD LONG NOUGH</tt>: | This statement sets %JUNK to <tt>W HAV WAITD LONG NOUGH</tt>: | ||
<p class="code"> %JUNK = $DelCh(' WE HAVE WAITED LONG ENOUGH ', 'E', , 3) | <p class="code"> %JUNK = $DelCh(' WE HAVE WAITED LONG ENOUGH ', 'E', , 3) | ||
</p> | </p> | ||
And this statement sets %JUNK to <tt>WE HAV AITD ONG NOUGH</tt>: | And this statement sets %JUNK to <tt>WE HAV AITD ONG NOUGH</tt>: | ||
Line 60: | Line 56: | ||
<p class="caption">Products authorizing $DelCh | <p class="caption">Products authorizing $DelCh | ||
</p> | </p> | ||
[[Category:$Functions|$DelCh]] | [[Category:$Functions|$DelCh]] |
Revision as of 20:46, 31 January 2011
<section begin="desc" />Remove characters from string, compress and strip blanks<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DelCh function is the Remove (String function).
This function removes specified characters from an input string and performs blank compression and stripping.
The $DelCh function accepts four 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 the set of characters to be removed from the first argument string.
The third argument is a starting position in the first argument string.
The fourth argument is a number indicating the type of blank compression or stripping to be performed. Valid numbers and their meanings are:
- delete the specified characters
- delete the specified characters and strip leading and trailing blanks
- delete the specified characters, strip leading and trailing blanks and compress multiple blanks to a single blank.
This is an optional argument and defaults to 1.
Syntax
<section begin="syntax" /> %STRING = $DelCh(string, chars, start_pos, option) <section end="syntax" />
For example, the following statement sets %JUNK to CD:
%JUNK = $DelCh('ABCDAAAABAB', 'AB')
This statement sets %JUNK to W HAV WAITD LONG NOUGH:
%JUNK = $DelCh(' WE HAVE WAITED LONG ENOUGH ', 'E', , 3)
And this statement sets %JUNK to WE HAV AITD ONG NOUGH:
%JUNK = $DelCh(' WE HAVE WAITED LONG ENOUGH ', 'WEL', 5, 3)