trim
This function removes all duplicate elements (multiple element with same value or contents) so every element inside is unique.
Indirect parameter passing is disabled
1
No. | Type | Description |
---|---|---|
1 input |
set | input set Attention: If 1st parameter is not a set, please refer to trim [string function] instead. |
Type | Description |
---|---|
set | trimmed set Set contains unique elements |
echo( trim( { a, b, c, d, c, b, a } ) );
echo( trim( { 'a', "a", A, "A" } ) ); // No difference made on quoted strings
echo( trim( { 1, {}, {a,b}, 1, {}, {b,a}, {a,b}, {a,b} } ) ); // No difference made on quoted strings
// Note: {a,b} is considered different to {b,a} and will not be trimmed
echo( trim( { 1, '1', 2, '2' } ) ); // No trimming (numerals differ from strings)
echo( trim( { } ), " / ", trim( { {},{},{} } ) ); // No element and 1 element
{'a','b','c','d'}
{'a','A'}
{1,{},{'a','b'},{'b','a'}}
{1,'1',2,'2'}
{} / {{}}