Identifying and removing redundant empty lines (consecutive newlines).

ID: 912

See: {@Newline}
				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
// Match two newlines in a row and replace with one
t.FromTo("{@nl} {@nl}", "{@nl}"); // {@nl} same as {@NewLine}

string text = "First\n\nSecond\n\nThird";

Console.WriteLine(t.Transform(text));
				
			
First
Second
Third
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   // Match two newlines in a row and replace with one
   t.FromTo("{@nl} {@nl}", "{@nl}"); // {@nl} same as {@NewLine}

   string text = "First\n\nSecond\n\nThird";

   cout << t.Transform(text) << endl;
}
				
			
First
Second
Third
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      '// Match two newlines in a row and replace with one
      t.FromTo("{@nl} {@nl}", "{@nl}") '// {@nl} same as {@NewLine}
      
      
      Dim text = $"First{vbLf}{vbLf}Second{vbLf}{vbLf}Third"
      Console.WriteLine(t.Transform(text))
   End Sub
End Module
				
			
First
Second
Third