Operator Type:
Operator Scope of Action:
Operator Purpose:
Data Type Returned:
Operator First Added:
Operator in Current Baseline:
Operator Last Altered:
Operator Has Optional Arguments:
Function [other Function type actions]
Item [operators of similar scope]
Stream parsing [other Stream parsing operators]
String [about String data type]
v9.1.0
Baseline
As at baseline
Syntax note: Operators without any defined mandatory arguments may omit their empty closing parentheses
String.captureWord(targetAttributeStr)
String.captureWord()
String.captureWord
Matches a word character at the start of String up to the first non-word character and stores the word in the specified targetAttributeStr, a quoted name of an attribute, and returns the string that follows this word. Fails if the string is empty or entirely white space.
What constitutes a word? This operator captures text from the current position up to (but not including) the next character that is a digit, whitespace, or punctuation.
If the targetAttributeStr is omitted the String is advanced to the end so processing ceases.
The value given for targetAttributeSt can be:
- a quoted literal string, e.g.
("Text")
for $Text. - an unquoted variable/loopVariable, e.g.
(vString)
for a variable 'vString'.
For example, if the stream is "Hello world":
vString = $Text.captureWord("SomeAttribute");
results in attribute $SomeAttribute
holding the value "Hello" and the variable vText
holding the value " world". If the stream does not start with a word, the operator fails. So, for a stream of "5. Hello world":
vString = $Text.captureWord("SomeAttribute");
results in attribute $SomeAttribute
holding no value and the variable vString
hosing the value "5. Hello world".
See also—notes linking to here: