right, right include, right last match, right last match include
This function extracts a right part of the string either with a character position number or a matching pattern.
Indirect parameter passing is disabled
2
No. | Type | Description |
---|---|---|
1 input |
valid types | input string or value Attention: If 1st parameter is a parameter set, please refer to right [parameter set function] instead. Values of types other than string will be converted to strings first. |
2 input |
numeral | character position Positive: Keep number of characters counted from the right (0 = blank string, 1 = last, etc.) |
Alt. 2 input |
string | matching pattern Function right ...: Return the right part of the string without the matching pattern. |
Type | Description |
---|---|
string | Extracted substring |
st[] = "The taste of the coffee!";
echo( right( st[], 0 ), " / ", right( st[], 1 ), " / ", right( st[], -2 ), " / ", right( st[], -1 ) );
echo( right( st[],99 ), " / ", right( st[],-99) );
echo;
echo( right( st[], ' taste' ), " / ", right include( st[], ' taste' ) );
echo( right( st[], ' ' ), " / ", right last match( st[], ' ' ) );
echo( right last match include( st[], 'e' ) ); // Last 'e' and exclamation mark
echo;
echo( right( st[], 't?ste' ) ); // Softquoted string (no or single quotation marks) - matched
echo( right( st[], "t?ste" ) ); // Quoted string (double quotation marks) - not matched
/ ! / e taste of the coffee! / he taste of the coffee!
The taste of the coffee! /
of the coffee! / taste of the coffee!
taste of the coffee! / coffee!
e!
of the coffee!
The taste of the coffee!
left [string function]
middle [string function]
outside [string function]
right [parameter set function]