width

Prev Next

Function Names

width

Description

This function returns the number of characters in the longest row in the string. If the value provided is not a string, then it will be converted to a string first. If the string contains no new line symbol, then the total number of characters is returned, like in function length [string function].
Attention: For numerals and dates with available string context, the string will be used.

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 will be converted to strings first. Parameter sets will be rejected.

Return value

TypeDescription
numeral Width

Number of characters of longest row

Examples

      text[] = compose( Hello, new line, Everyone, new line, "!!!" );
      echo(text[], new line );
      echo( "Width  = ",  width(text[]), new line, "Length = ", length(text[]) );

Output

Hello
Everyone
!!!

Width  = 8
Length = 18
Try it yourself: Open LIB_Function_width.b4p in B4P_Examples.zip. Decompress before use.

See also

height
length [string function]