height

Prev Next

Function Names

height

Description

This function returns the number rows the string is requiring. Empty strings and strings without line breaks (new line character) are considered 1 row, even if exotic UNICODE form feed or line break characters are inside. Clean them up first. Every new line character inside the string increases the height by 1, even if the new line character is at the end of the string.

Parmater of other types will be converted to strings first and then checked.

Vectorization: This function supports vectorization in the 1st function parameter. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter

Parameter count

1

Parameters

No.TypeDescription
1
input
valid types
set
input string or value

Values not of string type return height = 1. Vectorization applies if a set is provided.

Return value

TypeDescription
numeral
set
Height(s)

Number of rows needed. In case of vectorization being used, a set containing the results is returned

Examples

               echo( "Height 1  = ",  height ( 123.45 ) );
               echo( "Height 2  = ",  height ( { One element, With line break + new line } ) ); // Height = 2
               echo( "Height 3  = ",  height ( compose( Hello, new line, Everyone, new line, "!!!" ) ) );

Output

Height 1  = 1
Height 2  = {1,2}
Height 3  = 3
Try it yourself: Open LIB_Function_height.b4p in B4P_Examples.zip. Decompress before use.

See also

width
length [string function]