After (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
No edit summary
Line 1: Line 1:
{{Template:String:After subtitle}}
{{Template:String:After subtitle}}


This page is [[under construction]].
<var>After</var> operates on a string and returns the portion of that string after a user-specified delimiter.  To get the portion of the string before a delimiter, use the <var>[[Before (String function)|Before]]</var> string method.
 
==Syntax==
==Syntax==
{{Template:String:After syntax}}
{{Template:String:After syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outString</th><td>string</td></tr>
<tr><th>%outString</th>
<td>A string or longstring variable.  if a string is specified it must be long enough to hold the resulting parsed string.  If a string is defined shorter than needed to hold the result, a request canceling error occurs.</td></tr>
<tr><th>string</th>
<tr><th>string</th>
<td>string</td></tr>
<td>A string or longstring variable that holds the string to be parsed.</td></tr>
<tr><th>substring</th>
<tr><th>substring</th>
<td>string</td></tr>
<td>A string or longstring variable that holds the separator character or characters on which parsing occurs.</td></tr>
<tr><th><var>Start</var></th>
<tr><th><var>Start</var></th>
<td>number<br/>This default value of this argument is [[??]].</td></tr>
<td>number: The starting point for parsing.  The default value is 1, indicating the beginning of the string.  This is a name-optional argument and cannot be 0.  If a value larger than the string is specified, the method always returns a null string.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
If a starting value is entered, the %outString is the content of the string beginning after the first occurrence of the delimiter string encountered after the specified start point, and ending at the end of the string.
The delimiter string is not a list of individual delimiters, but a single delimiter which may be multiple characters.  In other words, if your delimiter is 'ok', the method looks for occurrences of those two lower-case letters and returns a value after said occurrence,
This method is always case-sensitive.
==Examples==
==Examples==
The following request prints the following string (note the initial blank!):
<p><code>  I am the Walrus!  Koo Koo Kachoo!</code></p>
<p class="code">begin
  %x is string len 64 initial('I am the Eggman!  I am the Walrus!  Koo Koo Kachoo!')
  printText {%x:after('!')}
end
</p>
The following request prints
<p><code>  Koo Koo Kachoo!</code></p>
<p class="code">begin
  %x is string len 64 initial('I am the Eggman!  I am the Walrus!  Koo Koo Kachoo!')
  printText {%x:after('!',start=20)}
end
</p>
The following prints each blank-delimited word, one at a time.
<p class="code">begin
  %x is string len 64 initial('I am the Eggman!  I am the Walrus!  Koo Koo Kachoo!')
  repeat while %x:length
    print %x:before(' ')
    %x = %x:after(' ')
  end repeat
end
</p>
==See also==
==See also==
{{Template:String:After footer}}
{{Template:String:Before footer}}
The <var>[[Before (String function)|Before]]</var> string method.

Revision as of 20:43, 23 April 2014

Part of string after a substring (String class)

[Introduced in Model 204 7.5]


After operates on a string and returns the portion of that string after a user-specified delimiter. To get the portion of the string before a delimiter, use the Before string method.

Syntax

%outString = string:After( substring, [Start= number])

Syntax terms

%outString A string or longstring variable. if a string is specified it must be long enough to hold the resulting parsed string. If a string is defined shorter than needed to hold the result, a request canceling error occurs.
string A string or longstring variable that holds the string to be parsed.
substring A string or longstring variable that holds the separator character or characters on which parsing occurs.
Start number: The starting point for parsing. The default value is 1, indicating the beginning of the string. This is a name-optional argument and cannot be 0. If a value larger than the string is specified, the method always returns a null string.

Usage notes

If a starting value is entered, the %outString is the content of the string beginning after the first occurrence of the delimiter string encountered after the specified start point, and ending at the end of the string. The delimiter string is not a list of individual delimiters, but a single delimiter which may be multiple characters. In other words, if your delimiter is 'ok', the method looks for occurrences of those two lower-case letters and returns a value after said occurrence, This method is always case-sensitive.

Examples

The following request prints the following string (note the initial blank!):

I am the Walrus! Koo Koo Kachoo!

begin %x is string len 64 initial('I am the Eggman! I am the Walrus! Koo Koo Kachoo!') printText {%x:after('!')} end

The following request prints

Koo Koo Kachoo!

begin %x is string len 64 initial('I am the Eggman! I am the Walrus! Koo Koo Kachoo!') printText {%x:after('!',start=20)} end

The following prints each blank-delimited word, one at a time.

begin %x is string len 64 initial('I am the Eggman! I am the Walrus! Koo Koo Kachoo!') repeat while %x:length print %x:before(' ') %x = %x:after(' ') end repeat end

See also

The Before string method.