Tinderbox v9 Icon

String.sentence([sentenceNum])


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]

 Data manipulation  [other Data manipulation operators]

 Baseline

 As at baseline

 [More on optional operator arguments]


String.sentence([sentenceNum])

The dot-operator .sentence(sentenceNum) extracts the sentenceNumth sentence from the source String, which most likely will be $Text. For example, if $Text contains the passage "Mr. Smith went to Washington. He shook hands. He kissed babies.", then"

$MyString = $Text.sentence(0); 

returns 'Mr. Smith went to Washington.' and

$Text.sentence(2) 

returns "He kissed babies."

If the sentenceNum argument is omitted, the initial sentence is returned. This is sentence 0 (zero) as sentenceNum is a zero-based index.

The definition of a 'sentence' is heuristic, and varies depending on the locale. In the example above, notice Tinderbox (in en-US locale) recognises that the period following "Mr." ends an abbreviation, not a sentence. The locale is derived from the users macOS settings but can also be set contextually using locale().