How to define and then permanently remove a rule.

ID: 145

See: Release
				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
string text = "(this and that) <this or that>";
t.Text = text;

// Define two rules
var rule1 = t.FromTo("({txt})", "#{txt}#");
var rule2 = t.FromTo("<{txt}>", "${txt}$");

// Transform with both rules active
Console.WriteLine(t.Transform());

// Release the first rule
rule1.Release();

// Re-run the transformation; only the second rule applies
t.Text = text;
Console.WriteLine(t.Transform());
				
			
#this and that# $this or that$
(this and that) $this or that$
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   string text = "(this and that) <this or that>";
   t.Text(text);

   // Define two rules
   auto rule1 = t.FromTo("({txt})", "#{txt}#");
   auto rule2 = t.FromTo("<{txt}>", "${txt}$");

   // Transform with both rules active
   cout << t.Transform() << endl;

   // Release the first rule
   rule1.Release();

   // Re-run the transformation; only the second rule applies
   t.Text(text);
   cout << t.Transform() << endl;
}
				
			
#this and that# $this or that$
(this and that) $this or that$
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      Dim text As String = "(this and that) <this or that>"
      t.Text = text
      
      '// Define two rules
      Dim rule1 = t.FromTo("({txt})", "#{txt}#")
      Dim rule2 = t.FromTo("<{txt}>", "${txt}$")
      
      '// Transform with both rules active
      Console.WriteLine(t.Transform())
      
      '// Release the first rule
      rule1.Release()
      
      '// Re-run the transformation; only the second rule applies
      t.Text = text
      Console.WriteLine(t.Transform())
   End Sub
End Module
				
			
#this and that# $this or that$
(this and that) $this or that$