Field_ParseText()

Examples


The Field_ParseText() function breaks up, or parses, a text field into strings.

Syntax

Field_ParseText(text_field, number_of_chars, start_position)

Parameters

text_field The text field you want to parse. The text_field can be a window field, table field or text local variable.

number_of_chars An integer indicating the maximum number of characters to be returned. This has an absolute maximum of 255 characters.

start_position An integer variable indicating the position in text_field from which to begin parsing. The beginning of the field is position 1. As text_field is parsed, the start_position variable is incremented by number_of_chars automatically. When the end of the text field is reached, the start_position variable is set to zero.

Return value

String

Comments

This function returns characters to a string field until the specified number_of_chars for the string is reached, or until a carriage return is encountered.

This function can be used in a loop (see the following example) to retrieve consecutive sections of a text field, and return the retrieved strings to an array field. If a carriage return is encountered, no more characters will be returned to the current string. The characters returned to the string in the next loop will begin immediately following the carriage return.

The defined number_of_chars may not be returned each time this function is used, since the string values returned will never stop in the middle of a word.


Returned strings always break at spaces. For example, if you split the following line into 30-character strings, the string returned would break before the word “this” instead of breaking after the “h” in “this.” Therefore, only 28 characters will be returned.

[spacer]


Documentation Feedback