Lingo Dictionary > G-K > item...of |  |

item...of

Syntax

    textMemberExpression.item[whichItem]
    item whichItem of fieldOrStringVariable
    textMemberExpression.item[firstItem..lastItem]
    item firstItem to lastItem of fieldOrStringVariable

Description

Keyword; specifies an item or range of items in a chunk expression. An item in this case is any sequence of characters delimited by the current delimiter as determined by the `itemDelimiter` property.

The terms `whichItem`, `firstItem`, and `lastItem` must be integers or integer expressions that refer to the position of items in the chunk.

Chunk expressions refer to any character, word, item, or line in any source of strings. Sources of strings include field and text cast members and variables that hold strings.

When the number that specifies the last item is greater than the item's position in the chunk expression, the actual last item is specified instead.

Example

This statement looks for the third item in the chunk expression that consists of names of colors and then displays the result in the Message window:

    put "red, yellow, blue green, orange".item[3]
    -- "blue green"

The result is the entire chunk "blue green" because this is the entire chunk between the commas."

Example

This statement looks for the third through fifth items in the chunk expression. Because there are only four items in the chunk expression, only the third item is used and fourth items are returned. The result appears in the Message window.

    put "red, yellow, blue green, orange".item[3..5]"
    -- " blue green, orange"
    put item 5 of "red, yellow, blue green, orange"
    -- ""

Example

This statement inserts the item Desk as the fourth item in the second line of the field cast member All Bids:

    member("All Bids").line[2].item[4] = "Desk"

See also

`char...of`, `itemDelimiter`, `number (items), word...of`