Warning
uCalc API Preview Release Notice:The uCalc engine has successfully transitioned to modern cross-platform environments.The next phase envolves some structural changes, performance optimizations, and API refinements.The API is subject to breaking changes prior to the stable release. Please evaluate the preview version thoroughly before production use.
Current uCalc String object
Text that is returned as a list can have a prefix, postfix, and separators between elements. A list of items within curly braces might have an open curly brace as prefix, a comma as delimiter, and a closing curly brace as postfix.
ID: 1138
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// RewindOnChange is necessary for cascading rules to be re-evaluated.
t.FromTo("A", "B").RewindOnChange = true;
t.FromTo("B", "C").RewindOnChange = true;
t.FromTo("C", "D").RewindOnChange = true;
// Trace the transformation of "A"
uCalc.String trace = t.TraceTransform("A");
// Format the output list with ' -> ' for readability
trace.ListSeparator(" -> ");
Console.WriteLine(trace);
A -> B -> C -> D using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // RewindOnChange is necessary for cascading rules to be re-evaluated. t.FromTo("A", "B").RewindOnChange = true; t.FromTo("B", "C").RewindOnChange = true; t.FromTo("C", "D").RewindOnChange = true; // Trace the transformation of "A" uCalc.String trace = t.TraceTransform("A"); // Format the output list with ' -> ' for readability trace.ListSeparator(" -> "); Console.WriteLine(trace);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// RewindOnChange is necessary for cascading rules to be re-evaluated.
t.FromTo("A", "B").RewindOnChange(true);
t.FromTo("B", "C").RewindOnChange(true);
t.FromTo("C", "D").RewindOnChange(true);
// Trace the transformation of "A"
uCalc::String trace = t.TraceTransform("A");
// Format the output list with ' -> ' for readability
trace.ListSeparator(" -> ");
cout << trace << endl;
}
A -> B -> C -> D #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // RewindOnChange is necessary for cascading rules to be re-evaluated. t.FromTo("A", "B").RewindOnChange(true); t.FromTo("B", "C").RewindOnChange(true); t.FromTo("C", "D").RewindOnChange(true); // Trace the transformation of "A" uCalc::String trace = t.TraceTransform("A"); // Format the output list with ' -> ' for readability trace.ListSeparator(" -> "); cout << trace << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// RewindOnChange is necessary for cascading rules to be re-evaluated.
t.FromTo("A", "B").RewindOnChange = true
t.FromTo("B", "C").RewindOnChange = true
t.FromTo("C", "D").RewindOnChange = true
'// Trace the transformation of "A"
Dim trace As uCalc.String = t.TraceTransform("A")
'// Format the output list with ' -> ' for readability
trace.ListSeparator(" -> ")
Console.WriteLine(trace)
End Sub
End Module
A -> B -> C -> D Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// RewindOnChange is necessary for cascading rules to be re-evaluated. t.FromTo("A", "B").RewindOnChange = true t.FromTo("B", "C").RewindOnChange = true t.FromTo("C", "D").RewindOnChange = true '// Trace the transformation of "A" Dim trace As uCalc.String = t.TraceTransform("A") '// Format the output list with ' -> ' for readability trace.ListSeparator(" -> ") Console.WriteLine(trace) End Sub End Module
ID: 1139
using uCalcSoftware;
var uc = new uCalc();
var t = uc.ExpressionTransformer;
// Assume these rules are pre-defined to create a recursive sum
t.FromTo("MySum({x})", "{x}");
t.FromTo("MySum({x}, {y})", "({x} + MySum({y}))").RewindOnChange = true;
uCalc.String trace = t.TraceTransform("MySum(1,2,3,4)");
trace.ListSeparator("\n");
Console.WriteLine(trace);
MySum(1,2,3,4)
(1 + MySum(2,3,4))
(1 + (2 + MySum(3,4)))
(1 + (2 + (3 + MySum(4))))
(1 + (2 + (3 + 4))) using uCalcSoftware; var uc = new uCalc(); var t = uc.ExpressionTransformer; // Assume these rules are pre-defined to create a recursive sum t.FromTo("MySum({x})", "{x}"); t.FromTo("MySum({x}, {y})", "({x} + MySum({y}))").RewindOnChange = true; uCalc.String trace = t.TraceTransform("MySum(1,2,3,4)"); trace.ListSeparator("\n"); Console.WriteLine(trace);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.ExpressionTransformer();
// Assume these rules are pre-defined to create a recursive sum
t.FromTo("MySum({x})", "{x}");
t.FromTo("MySum({x}, {y})", "({x} + MySum({y}))").RewindOnChange(true);
uCalc::String trace = t.TraceTransform("MySum(1,2,3,4)");
trace.ListSeparator("\n");
cout << trace << endl;
}
MySum(1,2,3,4)
(1 + MySum(2,3,4))
(1 + (2 + MySum(3,4)))
(1 + (2 + (3 + MySum(4))))
(1 + (2 + (3 + 4))) #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.ExpressionTransformer(); // Assume these rules are pre-defined to create a recursive sum t.FromTo("MySum({x})", "{x}"); t.FromTo("MySum({x}, {y})", "({x} + MySum({y}))").RewindOnChange(true); uCalc::String trace = t.TraceTransform("MySum(1,2,3,4)"); trace.ListSeparator("\n"); cout << trace << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.ExpressionTransformer
'// Assume these rules are pre-defined to create a recursive sum
t.FromTo("MySum({x})", "{x}")
t.FromTo("MySum({x}, {y})", "({x} + MySum({y}))").RewindOnChange = true
Dim trace As uCalc.String = t.TraceTransform("MySum(1,2,3,4)")
trace.ListSeparator(vbCrLf)
Console.WriteLine(trace)
End Sub
End Module
MySum(1,2,3,4)
(1 + MySum(2,3,4))
(1 + (2 + MySum(3,4)))
(1 + (2 + (3 + MySum(4))))
(1 + (2 + (3 + 4))) Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.ExpressionTransformer '// Assume these rules are pre-defined to create a recursive sum t.FromTo("MySum({x})", "{x}") t.FromTo("MySum({x}, {y})", "({x} + MySum({y}))").RewindOnChange = true Dim trace As uCalc.String = t.TraceTransform("MySum(1,2,3,4)") trace.ListSeparator(vbCrLf) Console.WriteLine(trace) End Sub End Module
This page last modified on: