The WORD function returns a specified word (contiguous string of characters) from a source data string, based on its position with the string. This function examines a source data string and extracts a single word from the string based on a positional number that is provided in the WORD function. Extracting a word within a data string implies that there are spaces between string of contiguous characters.
Category
String
Syntax
WORD(data_string, position)
Parameters and Descriptions
Parameter | Description |
---|---|
data_string | The source data string in character format. The data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
position | This parameter specifies the numerical position of the word within the source data string. This parameter may be a field/column of a datastore, a literal value or the output of another Function. |
Example
Examine source data field INPUT_STRING and extract the 5th word from the string. Assume that INPUT_STRING contains the value This is a test for word extraction. Map the result to target field TGT_WORD.
TGT_WORD = WORD (Input_String, 5)
Returns the word 'for' and maps the result to the target field.