This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

Stream.captureNumber[("targetAttribute")]


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Stream parsing   [other Stream parsing operators]

 9.1.0

 


Stream.captureNumber("targetAttribute")

Stream.captureNumber

Searches forward in the Stream and matches the first detected number in the stream and optionally stores that number in the attribute specified by targetAttribute,. It then returns the string that follows that number (to any left side recipient) whilst the Stream is advanced to a position after the number. The operator fails if the match is empty or entirely white space, with no result.

A number is assumed to be any character continuous sequence of one or more number characters between 0–9 (zero through nine). Formatted numbers will not be fully matched. Any further text after the number is ignored, b oth for the capture and advancing the Stream.

Thus sequence "There are 1234 items" makes a 'number' match of 1234. But for "There are 1,234 items" or "There are 1.234 items" the match will be the first number (1) only as it is followed by a non-number character.

If the targetAttribute is omitted the Stream is advanced to after the number without any data being saved.

The attribute given for targetAttribute can be a quoted literal string, e.g. ("Text") for $Text. Or it can be an unquoted variable/loopVariable, e.g. (vString) for a variable 'vString'.



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : Stream.captureNumber[("targetAttribute")]