What action code can do the work of a $LineCount Attribute?

Any suggestions to count lines - instances of line breaks will do - in my $Text?

In Tinderbox ‘line’ and ‘paragraph’ are essentially the same thing. A line break (\n) in text, however rendered on screen in line spacing terms) delimits ‘paragraphs’. A paragraph can contain multiple sentences but a line break (as opposed to an on-screen line wrap) delimits a single line/paragraph.

Try String.paragraphCount(). For instance:

$MyNumber = $Text.paragraphCount;

The above ignores ‘blank’ paragraphs, i.e. sequences of 2 or more consecutive line breaks. However, I think that aligns with your intent. In case you’re wondering there is not a ready-calculated $ParagraphCount, holding the result of the above, but the action code would work.

It may be a different nuance you’re after in which case a bit more context might be needed. HTH :slight_smile:

This is perfect! Thanks much @mwra :clap::clap:

1 Like