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.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
valid types input string or value

Values not of string type return height = 1

Return value

TypeDescription
numeral Height

Number of rows needed

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  = 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]