MoneyWorks Manual
CountLines (text [, asciiDelimiter])
Result Type: number
Definition: Returns the number of lines in the text string. By default the end of line character is "\n", but a different character can be used if passed as the optional second parameter.
Examples: Where text = "Line 1\tA\nLine2\tB\nLine 3\tC"
CountLines(text)
returns 3 (the number of lines)
CountLines(text, "\t")
returns 4 (there are 3 tab characters, giving 4 "lines")
CountLines(text+"\t", "\t")
returns 4. The last character is a trailing delimiter and does not count as another column. That is so that the common case of counting
"one\n two\n three\n"
and
"one\n two\n three"
both return 3. This may catch you out if you use CountLines to count columns and the last column may blank but you do expect it to count. In this case (assuming tab column delimiters) it may pay to use the idiom CountLines(text+"\n", "\t")
so that a final, empty, tab-delimited column is counted.