left, left include, left last match, left last match include, vleft, vleft include, vleft last match, vleft last match include
This function extracts a left part of the string either with a character position number or a matching pattern.
Vectorization: The function names beginning with the prefix v support vectorization in the 1st function parameter.
Instead of providing a single value, you can provide a set or even a nested set which contain multiple values.
The function will then process every value and its return value contains a corresponding set containing all results.
Note:For these functions, you need add the prefix letter 'v' in front of the function name. Otherwise
the function recognizes a set and attempts to process sets and not strings.
See left [set function] for the corresponding set function.
Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter
2
No. | Type | Description |
---|---|---|
1 input |
valid types | input string or value(s) Attention: Numerals and dates are converted to strings prior to processing. If 1st parameter is a set:
|
2 input |
numeral | character position Positive: Keep number of characters counted from the left (0 = blank string, 1 = 1st character, etc.) |
Alt. 2 input |
string | matching pattern Function left ...: Return the left part of the string without the matching pattern. |
Type | Description |
---|---|
string set |
Extracted substring(s) In case vectorization has been applied, then the resulting strings are returned inside a (nested) set. |
st[] = "The taste of the coffee!";
echo( left( st[], 0 ), " / ", left( st[], 1 ), " / ", left( st[], -2 ), " / ", left( st[], -1 ) );
echo( left( st[],99 ), " / ", left( st[],-99) );
echo;
echo( left( st[], ' taste' ), " / ", left include( st[], ' taste' ) );
echo( left( st[], ' ' ), " / ", left last match( st[], ' ' ) );
echo( left last match include( st[], 'e' ) ); // Strips exclamation mark only
echo;
echo( left( st[], 'c^ffee' ) ); // Softquoted string (no or single quotation marks) - matched
echo( left( st[], "c^ffee" ) ); // Quoted string (double quotation marks) - not matched
/ T / The taste of the coffe / The taste of the coffee
The taste of the coffee! /
The / The taste
The / The taste of the
The taste of the coffee
The taste of the
The taste of the coffee!
right [string function]
middle [string function]
outside [string function]
left [set function]