Before (String function)

From m204wiki
Revision as of 19:33, 23 April 2014 by Alan (talk | contribs)
Jump to navigation Jump to search

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 After 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('!',start=10)} end

See also

The Before string method.