$LISTFROMSTRING (SQL)
Synopsis
$LISTFROMSTRING(string[,delimiter])
Description
$LISTFROMSTRING takes a quoted string containing delimited elements and returns a list. A list represents data in an encoded format which does not use delimiter characters. Thus a list can contain all possible characters, and is ideally suited for bitstring data. Lists are handled using the ObjectScript and InterSystems SQL $LIST functions.
Arguments
string
A string literal (enclosed in single quotation marks), a numeric, or a variable or expression that evaluates to a string. This string can contain one or more substrings (elements), separated by a delimiter. The string data elements must not contain the delimiter character (or string), because the delimiter character is not included in the output list.
delimiter
An optional character (or string of characters) used to delimit substrings within the input string. It can be a numeric or string literal (enclosed in single quotation marks), the name of a variable, or an expression that evaluates to a string.
Commonly, a delimiter is a designated character which is never used within string data, but is set aside solely for use as a delimiter separating substrings. A delimiter can also be a multi-character string, the individual characters of which can be used within string data. If you specify no delimiter, the default delimiter is the comma (,) character.
Examples
The following example takes a string of names which are separated by a blank space, and creates a list:
SELECT $LISTFROMSTRING("Deborah Noah Martha Bowie",' ')
The following example uses the default delimiter (the comma character), and creates a list:
SELECT $LISTFROMSTRING("Deborah,Noah,Martha,Bowie")
See Also
-
SQL functions: $LIST $LISTBUILD $LISTDATA $LISTFIND $LISTGET $LISTLENGTH $LISTSAME $LISTTOSTRING $PIECE
-
ObjectScript functions: $LIST $LISTBUILD $LISTDATA $LISTFIND $LISTFROMSTRING $LISTGET $LISTLENGTH $LISTNEXT $LISTSAME $LISTTOSTRING $LISTVALID