Tinderbox v9 Icon

String.paragraphList


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Property  [other Property type actions]

 Item  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]

 9.0.0

 As at baseline


String.paragraphList

The .paragraphList operator returns a list of paragraphs contained in a string. This operator requires running on macOS 10.14 and later. For example, to get a list of the discrete paragraphs in $Text:

$MyList = $Text.paragraphList; 

To set a string to the third paragraph of $Text (recall the .at(N) operator is zero-based):

$MyString = $Text.paragraphList.at(2); 

If wanting to iterate and test paragraphs, rather than chain $Text.paragraphList.each(){}, use the newer stream parsing method $Text.eachLine(){}. In both instance a line—or paragraph—is a substring—delimited by one of more successive line breaks.

Source paragraphs containing semicolons

As .paragraphList returns a List, if any source paragraph containing a semicolon it will create more than one item in the returned list. In such circumstances, in may be better to use .eachLine() instead.