Before (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:Before subtitle}}
{{Template:String:Before subtitle}}


This page is [[under construction]].
<var>Before</var> operates on a string and returns the portion of that string prior to the user-specified delimiter.  To get the portion of the string after a delimiter, use the <var>[[After (String function)|Before]]</var> string method.
==Syntax==
==Syntax==
{{Template:String:Before syntax}}
{{Template:String:Before syntax}}
Line 15: Line 15:
</table>
</table>
==Usage notes==
==Usage notes==
==Examples==
==Examples==
The following request prints
<p><code>I am the Eggman</p>
<p class="code">begin
  %x is string len 64 initial('I am the Eggman!  I am the Walrus!  Koo Koo Kachoo!')
  printText {%x:before('!')}
end
</p>
The following request prints
<p><code>Eggman!</p>
<p class="code">begin
  %x is string len 64 initial('I am the Eggman!  I am the Walrus!  Koo Koo Kachoo!')
  printText {%x:before('!',10)}
end
</p>
==See also==
==See also==
{{Template:String:Before footer}}
{{Template:String:Before footer}}
The <var>[[After (String function)|Before]]</var> string method.

Revision as of 19:32, 23 April 2014

Part of string before a substring (String class)

[Introduced in Model 204 7.5]


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

Syntax

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

Syntax terms

%outStringstring
string string
substring string
Start number
This default value of this argument is ??.

Usage notes

Examples

The following request prints

I am the Eggman

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

The following request prints

Eggman!

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

See also

The Before string method.