length
This function returns the number of characters in the string. New line symbols count as 1 character. If the value provided is not a string, then it will be converted to a string first.
Attention: For numerals and dates with available string context, the string will be used.
A simpler approach is to use {} behind the string, referred as length of strings. This simplified appraoch runs faster, but assumes
a string value to be provided all times.
Indirect parameter passing is disabled
1
No. | Type | Description |
---|---|---|
1 input |
valid types | input string or value Attention: If 1st parameter is a parameter set, please refer to length [parameter set function] instead. Values of types other than string will be converted to strings first. |
Type | Description |
---|---|
numeral | Length Number of characters |
echo( length( 007.0 ) ); // 5 characters (string context preserved)
echo( length( 007.0 + 0 ) ); // 1 character (7) after a calculation
echo( length( 1=1 ) ); // 4 characters (true)
echo( length( Hello ) ); // 5 chracters
echo( length( date(today)) ); // 10 characters: YYYY-MM-DD
5
1
4
5
10
length [parameter set function]
width
length of strings