Demonstrates the basic toggle functionality of the Active property.
ID: 862
See: Active = [bool]
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
string UserText = "The cat saw another cat.";
t.Text = UserText;
// Define a rule and hold its handle
var catRule = t.FromTo("cat", "dog");
Console.Write("1. Rule Active (Default): ");
Console.WriteLine(t.Transform());
// Deactivate the rule
catRule.Active = false;
// Re-run the transform to see the change
Console.Write("2. Rule Inactive: ");
t.Text = UserText;
Console.WriteLine(t.Transform());
// Reactivate the rule
catRule.Active = true;
Console.Write("3. Rule Reactivated: ");
Console.WriteLine(t.Transform());
1. Rule Active (Default): The dog saw another dog.
2. Rule Inactive: The cat saw another cat.
3. Rule Reactivated: The dog saw another dog. using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); string UserText = "The cat saw another cat."; t.Text = UserText; // Define a rule and hold its handle var catRule = t.FromTo("cat", "dog"); Console.Write("1. Rule Active (Default): "); Console.WriteLine(t.Transform()); // Deactivate the rule catRule.Active = false; // Re-run the transform to see the change Console.Write("2. Rule Inactive: "); t.Text = UserText; Console.WriteLine(t.Transform()); // Reactivate the rule catRule.Active = true; Console.Write("3. Rule Reactivated: "); Console.WriteLine(t.Transform());
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
string UserText = "The cat saw another cat.";
t.Text(UserText);
// Define a rule and hold its handle
auto catRule = t.FromTo("cat", "dog");
cout << "1. Rule Active (Default): ";
cout << t.Transform() << endl;
// Deactivate the rule
catRule.Active(false);
// Re-run the transform to see the change
cout << "2. Rule Inactive: ";
t.Text(UserText);
cout << t.Transform() << endl;
// Reactivate the rule
catRule.Active(true);
cout << "3. Rule Reactivated: ";
cout << t.Transform() << endl;
}
1. Rule Active (Default): The dog saw another dog.
2. Rule Inactive: The cat saw another cat.
3. Rule Reactivated: The dog saw another dog. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); string UserText = "The cat saw another cat."; t.Text(UserText); // Define a rule and hold its handle auto catRule = t.FromTo("cat", "dog"); cout << "1. Rule Active (Default): "; cout << t.Transform() << endl; // Deactivate the rule catRule.Active(false); // Re-run the transform to see the change cout << "2. Rule Inactive: "; t.Text(UserText); cout << t.Transform() << endl; // Reactivate the rule catRule.Active(true); cout << "3. Rule Reactivated: "; cout << t.Transform() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
Dim UserText As String = "The cat saw another cat."
t.Text = UserText
'// Define a rule and hold its handle
Dim catRule = t.FromTo("cat", "dog")
Console.Write("1. Rule Active (Default): ")
Console.WriteLine(t.Transform())
'// Deactivate the rule
catRule.Active = false
'// Re-run the transform to see the change
Console.Write("2. Rule Inactive: ")
t.Text = UserText
Console.WriteLine(t.Transform())
'// Reactivate the rule
catRule.Active = true
Console.Write("3. Rule Reactivated: ")
Console.WriteLine(t.Transform())
End Sub
End Module
1. Rule Active (Default): The dog saw another dog.
2. Rule Inactive: The cat saw another cat.
3. Rule Reactivated: The dog saw another dog. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() Dim UserText As String = "The cat saw another cat." t.Text = UserText '// Define a rule and hold its handle Dim catRule = t.FromTo("cat", "dog") Console.Write("1. Rule Active (Default): ") Console.WriteLine(t.Transform()) '// Deactivate the rule catRule.Active = false '// Re-run the transform to see the change Console.Write("2. Rule Inactive: ") t.Text = UserText Console.WriteLine(t.Transform()) '// Reactivate the rule catRule.Active = true Console.Write("3. Rule Reactivated: ") Console.WriteLine(t.Transform()) End Sub End Module