Skip to main content

Multi-valued Strings

One of Caché's distinctive features is its ability to work easily with multi-valued strings. A variable can contain up to 32K of data, so it's easy to use one variable to hold a string of multiple values (sub-strings). Consider the string as a record, and the substrings as its fields. There are two approaches: delimited strings, or lists. Delimited strings use a designated character—such as “^”—to separate the values. Lists are similar, but the separator is managed internally and is not of concern to the programmer.

  • Build delimited strings via concatenation. Use Piece(), which looks at a string as a series of pieces, based on a delimiter, to return a specific piece. Use a two-argument form of Len() to return the number of pieces in the string, based on a delimiter. Use InStr() to search for a piece.

  • Build lists using ListBuild(). Use List() to return an item in the list. Use ListLength() to return the number of items in the list, and ListFind() to search for an item.

FeedbackOpens in a new tab