left , left include , left last match , left last match include
This function extracts a left part of the set either with a element position number or a subset resembling a matching element.
Indirect parameter passing is disabled
Min 2
No. | Type | Description |
---|---|---|
1 input |
set | input set Attention: If 1st parameter is not a set, please refer to left [string function] instead. |
2 input |
numeral | set position Positive: Select the first n elements of the set. |
Alt. 2 input |
set | matching elements Function left ...: Return the left part of the set without the matching element. |
Opt. 3+ io |
set | follower Other sets in addition to the one provided as the first function parameter can be extracted in the same same way. Add any number of additional set variables. They will be manipulated at the exact same positions as the returned value. |
Type | Description |
---|---|
set | Extracted subset |
set[] = { the, taste, of, the, 12, coffees, '!' };
echo( left( set[], 0 ), ", ", left( set[], 1 ), ", ", left( set[], -2 ), ", ", left( set[], -1 ) );
echo( left( set[],99 ), ", ", left( set[], -99) );
echo;
echo( left( set[], { 12, of } ), " / ", left include( set[], { 12, of } ) ); // Recognized 'of' as 1st match
echo( left last match ( set[], {the} ), ", ", left last match include( set[], {the} ) );
echo( left( set[], {tea } ) ); // Returns full set because element not found
echo( new line, "Demonstrate the follower feature: ");
set2[] = { A, fragrance, coming, from, 120, espressos, '!' };
set3[] = { Der, Geschmack, kommt, von, 120, Tassen Kaffee, '!' };
echo( "Extraction 1: ", left( set[], {of}, set2[], set3[] ) );
echo( "Extraction 2: ", set2[] );
echo( "Extraction 3: ", set3[] );
{}, {'the'}, {'the','taste','of','the',12}, {'the','taste','of','the',12,'coffees'}
{'the','taste','of','the',12,'coffees','!'}, {}
{'the','taste'} / {'the','taste','of'}
{'the','taste','of'}, {'the','taste','of','the'}
{'the','taste','of','the',12,'coffees','!'}
Demonstrate the follower feature:
Extraction 1: {'the','taste'}
Extraction 2: {'A','fragrance'}
Extraction 3: {'Der','Geschmack'}
right [set function]
middle [set function]
outside [set function]
left [string function]