08-01-2020, 03:51 AM
(This post was last modified: 08-01-2020, 02:31 PM by Start_Learning.)
Try this function:
Function TrimMultiBlankLines
Usage: TrimMultiBlankLines [string_text]
Function TrimMultiBlankLines
;Reduce multi blank lines into one blank line only.
function str'text
str line
int emptyLineCount emptyLineExist
out
foreach line text
,line.trim()
,if (len(line) = 0)
,,emptyLineCount +=1
,,emptyLineExist = 1
,,if (emptyLineCount > 1)
,,,emptyLineExist = 0
,else
,,out line
,,emptyLineCount = 0
,if (emptyLineExist )
,,out ""
,,emptyLineExist = 0
Usage: TrimMultiBlankLines [string_text]