@Word (Formula Language)
Returns the specified word from a text string. A "word" is defined as the part of a string that is delimited by the defined separator character. For example, if you specify a space (" ") as the separator, then a word is any series of characters preceded by and followed by a space (or the beginning or end of the string).
@Word( string ; separator ; number )
Syntax
string
Text or text list. The string you want to scan.
separator
Text. The character that you want used to delimit a word in the string.
number
Number. A position indicating which word you want returned from string. A positive number refers to the position of the word starting from the beginning where 1 is the first word. A negative number refers to the position of the word starting from the end where -1 is the last word.
Return value
word
Text or text list. The word that holds the position specified by the number in the string; for example, if number is 3, @Word returns the third word in the string. If a text list is used, @Word returns (in list format) a word from each list that holds the specified position. Returns an empty string if number is out of range, except that 0 is equivalent to 1.
Examples
- This example returns Collins,.
@Word("Larson, Collins, and Jensen"; " " ; 2)
- This example returns Collins,:Marketing,.
@Word("Larson, Collins, and Jensen":"Sales, Marketing, and Administration";" ";2)
- This example returns M.; here, the specified separator is the
comma. The string contains 3 words: Larson, James, and M.
@Word("Larson,James,M.";",";3)
- This example returns Larson if James Larson is the name associated
with the current user ID. It returns M. if James M. Larson is the
name associated with the current user ID.
@Word(@Username;" ";2)
- This example returns Larson if James Larson is the name associated
with the current user ID. It also returns Larson if James M. Larson
is the name associated with the current user ID.
@Word(@Username;" ";-1)