Tinderbox v9 Icon

String.captureWord([targetAttributeStr])


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

Operator Has Optional Arguments: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Stream parsing  [other Stream parsing operators]

 Baseline

 As at baseline

 [More on optional operator arguments]


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:

For example, if the stream is "Hello world":

vString = $Text.captureWord("SomeAttribute"); 

results in attribute $SomeAttribute holding the value "Hello" and the variable vText hosing the value " world". If the stream does not start with a word, the operator fail. So, for a stream of "5. Hello world":

vString = $Text.captureWord("SomeAttribute"); 

results in attribute $SomeAttribute holding no value and the variable vText hosing the value "5. Hello world".