text row

Prev Next

Function Names

text row

Description

This function returns contents of the specified row from the string. For strings containing one single row, only row 0 contains text and all other row numbers return blank contents. In addition, the text can be padded with blanks or truncated if a width limit is specified.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2-3

Parameters

No.TypeDescription
1
input
valid types input string or value

The contents of the specified row will be extracted from this string.

2
input
numeral row number

Specify the row number of string to return

Opt. 3
input
numeral width limit

Limit the width of the string. If the string is shorter, then it will be padded. No actions if a negative value is provided. Note: Special formatting characters (UNICODE Privat use areas) such as colors or text attributes will be counted as zero width character. Example: &red;.

Default value: -1 (no actions)

Return value

TypeDescription
string Extracted row

The selected row from the string is returned.

Examples

example[] = """
The quick brown
fox jumps over the great and big, but
lazy dog.""";

echo("Example 1: 2 parameters passed");
for (i[] = 0, i[] < height(example[]), i[]++) echo( 'Row ', i[],': "', text row(example[], i[] ),'"' );

echo(new line, "Example 2: 3 parameters passed");
for (i[] = 0, i[] < height(example[]), i[]++) echo( 'Row ', i[],': "', text row(example[], i[], 18),'"' );

Output

Example 1: 2 parameters passed
Row 0: "The quick brown"
Row 1: "fox jumps over the great and big, but"
Row 2: "lazy dog."

Example 2: 3 parameters passed
Row 0: "The quick brown   "
Row 1: "fox jumps over the"
Row 2: "lazy dog.         "
Try it yourself: Open LIB_Function_text_row.b4p in B4P_Examples.zip. Decompress before use.

See also

width
height