trim ... (parameter set function)

Prev Next

Function Names

trim

Description

This function removes all duplicate elements (multiple element with same value or contents) so every element inside is unique.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
parameter set input parameter set

Attention: If 1st parameter is not a parameter set, please refer to trim [string function] instead.

Return value

TypeDescription
parameter set trimmed parameter set

Parameter set contains unique elements

Examples

      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

Output

{'a','b','c','d'}
{'a','A'}
{1,{},{'a','b'},{'b','a'}}
{1,'1',2,'2'}
{} / {{}}
Try it yourself: Open LIB_Function_trim_.b4p in B4P_Examples.zip. Decompress before use.

See also

trim [string function]