uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Defines sections of a pattern that may or may not exist, and provides syntax for conditional replacements based on whether a match occurred.
Optional parts allow you to define sections of a pattern that may or may not exist in the source string. These are enclosed in square brackets [...].
Syntax: Start [ Optional ] End
[{val}]), and the block is not matched, the variable will be empty.When a variable is defined within an optional block, you can use special syntax in the replacement string to conditionally display content.
| Syntax | Name | Behavior |
|---|---|---|
{var: ...} | Positive Condition | The content after the colon is inserted only if {var} captured a value. |
{!var: ...} | Fallback Content | The content after the colon is inserted only if {var} is empty (did not capture a value). |
This provides a powerful, declarative way to handle default values and conditional formatting without needing complex callbacks.
Because square brackets [ and ] are reserved for defining optional parts, if you need to match a literal square bracket in your text (e.g., a JSON array [1,2]), you must enclose the brackets in single quotes: '[' and ']'. This is a common requirement when parsing structured data formats.
vs. Regex (?):
(optional part)?. uCalc's square brackets [optional part] are visually cleaner and mimic standard documentation syntax (like Backus-Naur Form).((inner)?outer)?. uCalc uses intuitive nesting [ outer [ inner ] ] that clearly delineates hierarchy.{var: Label: {var}} and {!var: Default}.vs. Native Code (If/Else):
if checks or Split logic. uCalc handles the branching internally in a single declarative line.ID: 790
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("This is a [very] important test", "MATCHED");
// Matches with the optional word
Console.WriteLine(t.Transform("This is a very important test"));
// Also matches without the optional word
Console.WriteLine(t.Transform("This is a important test"));
MATCHED
MATCHED using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("This is a [very] important test", "MATCHED"); // Matches with the optional word Console.WriteLine(t.Transform("This is a very important test")); // Also matches without the optional word Console.WriteLine(t.Transform("This is a important test"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("This is a [very] important test", "MATCHED");
// Matches with the optional word
cout << t.Transform("This is a very important test") << endl;
// Also matches without the optional word
cout << t.Transform("This is a important test") << endl;
}
MATCHED
MATCHED #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("This is a [very] important test", "MATCHED"); // Matches with the optional word cout << t.Transform("This is a very important test") << endl; // Also matches without the optional word cout << t.Transform("This is a important test") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("This is a [very] important test", "MATCHED")
'// Matches with the optional word
Console.WriteLine(t.Transform("This is a very important test"))
'// Also matches without the optional word
Console.WriteLine(t.Transform("This is a important test"))
End Sub
End Module
MATCHED
MATCHED Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("This is a [very] important test", "MATCHED") '// Matches with the optional word Console.WriteLine(t.Transform("This is a very important test")) '// Also matches without the optional word Console.WriteLine(t.Transform("This is a important test")) End Sub End Module
ID: 791
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Pattern: Match "Log:", an optional level (Warning or Error), and the message.
// Replacement: Use `{!level:OK}` to insert 'OK' if no level was captured.
t.FromTo("Log: [{level: Warning | Error}] {msg}", "Status: {!level:OK}{level} | Message: {msg}");
Console.WriteLine(t.Transform("Log: This is a standard entry"));
Console.WriteLine(t.Transform("Log: Warning A potential issue was found"));
Console.WriteLine(t.Transform("Log: Error System failure detected"));
Status: OK | Message: This is a standard entry
Status: Warning | Message: A potential issue was found
Status: Error | Message: System failure detected using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Pattern: Match "Log:", an optional level (Warning or Error), and the message. // Replacement: Use `{!level:OK}` to insert 'OK' if no level was captured. t.FromTo("Log: [{level: Warning | Error}] {msg}", "Status: {!level:OK}{level} | Message: {msg}"); Console.WriteLine(t.Transform("Log: This is a standard entry")); Console.WriteLine(t.Transform("Log: Warning A potential issue was found")); Console.WriteLine(t.Transform("Log: Error System failure detected"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Pattern: Match "Log:", an optional level (Warning or Error), and the message.
// Replacement: Use `{!level:OK}` to insert 'OK' if no level was captured.
t.FromTo("Log: [{level: Warning | Error}] {msg}", "Status: {!level:OK}{level} | Message: {msg}");
cout << t.Transform("Log: This is a standard entry") << endl;
cout << t.Transform("Log: Warning A potential issue was found") << endl;
cout << t.Transform("Log: Error System failure detected") << endl;
}
Status: OK | Message: This is a standard entry
Status: Warning | Message: A potential issue was found
Status: Error | Message: System failure detected #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Pattern: Match "Log:", an optional level (Warning or Error), and the message. // Replacement: Use `{!level:OK}` to insert 'OK' if no level was captured. t.FromTo("Log: [{level: Warning | Error}] {msg}", "Status: {!level:OK}{level} | Message: {msg}"); cout << t.Transform("Log: This is a standard entry") << endl; cout << t.Transform("Log: Warning A potential issue was found") << endl; cout << t.Transform("Log: Error System failure detected") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Pattern: Match "Log:", an optional level (Warning or Error), and the message.
'// Replacement: Use `{!level:OK}` to insert 'OK' if no level was captured.
t.FromTo("Log: [{level: Warning | Error}] {msg}", "Status: {!level:OK}{level} | Message: {msg}")
Console.WriteLine(t.Transform("Log: This is a standard entry"))
Console.WriteLine(t.Transform("Log: Warning A potential issue was found"))
Console.WriteLine(t.Transform("Log: Error System failure detected"))
End Sub
End Module
Status: OK | Message: This is a standard entry
Status: Warning | Message: A potential issue was found
Status: Error | Message: System failure detected Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Pattern: Match "Log:", an optional level (Warning or Error), and the message. '// Replacement: Use `{!level:OK}` to insert 'OK' if no level was captured. t.FromTo("Log: [{level: Warning | Error}] {msg}", "Status: {!level:OK}{level} | Message: {msg}") Console.WriteLine(t.Transform("Log: This is a standard entry")) Console.WriteLine(t.Transform("Log: Warning A potential issue was found")) Console.WriteLine(t.Transform("Log: Error System failure detected")) End Sub End Module
ID: 792
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Pattern: Capture first, optional middle, and last names.
// Replacement: The block `{middle: {middle}}` ensures a leading space is only added if a middle name exists.
t.FromTo("Name: {first:1} [{middle:1}] {last:1}",
"User: {last}, {first}{middle: {middle}}");
Console.WriteLine(t.Transform("Name: John Doe"));
Console.WriteLine(t.Transform("Name: John Quincy Adams"));
User: Doe, John
User: Adams, John Quincy using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Pattern: Capture first, optional middle, and last names. // Replacement: The block `{middle: {middle}}` ensures a leading space is only added if a middle name exists. t.FromTo("Name: {first:1} [{middle:1}] {last:1}", "User: {last}, {first}{middle: {middle}}"); Console.WriteLine(t.Transform("Name: John Doe")); Console.WriteLine(t.Transform("Name: John Quincy Adams"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Pattern: Capture first, optional middle, and last names.
// Replacement: The block `{middle: {middle}}` ensures a leading space is only added if a middle name exists.
t.FromTo("Name: {first:1} [{middle:1}] {last:1}",
"User: {last}, {first}{middle: {middle}}");
cout << t.Transform("Name: John Doe") << endl;
cout << t.Transform("Name: John Quincy Adams") << endl;
}
User: Doe, John
User: Adams, John Quincy #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Pattern: Capture first, optional middle, and last names. // Replacement: The block `{middle: {middle}}` ensures a leading space is only added if a middle name exists. t.FromTo("Name: {first:1} [{middle:1}] {last:1}", "User: {last}, {first}{middle: {middle}}"); cout << t.Transform("Name: John Doe") << endl; cout << t.Transform("Name: John Quincy Adams") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Pattern: Capture first, optional middle, and last names.
'// Replacement: The block `{middle: {middle}}` ensures a leading space is only added if a middle name exists.
t.FromTo("Name: {first:1} [{middle:1}] {last:1}",
"User: {last}, {first}{middle: {middle}}")
Console.WriteLine(t.Transform("Name: John Doe"))
Console.WriteLine(t.Transform("Name: John Quincy Adams"))
End Sub
End Module
User: Doe, John
User: Adams, John Quincy Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Pattern: Capture first, optional middle, and last names. '// Replacement: The block `{middle: {middle}}` ensures a leading space is only added if a middle name exists. t.FromTo("Name: {first:1} [{middle:1}] {last:1}", "User: {last}, {first}{middle: {middle}}") Console.WriteLine(t.Transform("Name: John Doe")) Console.WriteLine(t.Transform("Name: John Quincy Adams")) End Sub End Module
ID: 197
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("a [simple] test", "<{@Self}>");
Console.WriteLine(t.Transform("Is this a simple test, or a hard test, or just a test?"));
Is this <a simple test>, or a hard test, or just <a test>? using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("a [simple] test", "<{@Self}>"); Console.WriteLine(t.Transform("Is this a simple test, or a hard test, or just a test?"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("a [simple] test", "<{@Self}>");
cout << t.Transform("Is this a simple test, or a hard test, or just a test?") << endl;
}
Is this <a simple test>, or a hard test, or just <a test>? #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("a [simple] test", "<{@Self}>"); cout << t.Transform("Is this a simple test, or a hard test, or just a test?") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("a [simple] test", "<{@Self}>")
Console.WriteLine(t.Transform("Is this a simple test, or a hard test, or just a test?"))
End Sub
End Module
Is this <a simple test>, or a hard test, or just <a test>? Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("a [simple] test", "<{@Self}>") Console.WriteLine(t.Transform("Is this a simple test, or a hard test, or just a test?")) End Sub End Module
ID: 198
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("This is a [{adj: simple}] test",
"Let's take the {adj}{!adj:short} test");
Console.WriteLine(t.Transform("This is a test"));
Console.WriteLine(t.Transform("This is a simple test"));
Let's take the short test
Let's take the simple test using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("This is a [{adj: simple}] test", "Let's take the {adj}{!adj:short} test"); Console.WriteLine(t.Transform("This is a test")); Console.WriteLine(t.Transform("This is a simple test"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("This is a [{adj: simple}] test",
"Let's take the {adj}{!adj:short} test");
cout << t.Transform("This is a test") << endl;
cout << t.Transform("This is a simple test") << endl;
}
Let's take the short test
Let's take the simple test #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("This is a [{adj: simple}] test", "Let's take the {adj}{!adj:short} test"); cout << t.Transform("This is a test") << endl; cout << t.Transform("This is a simple test") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("This is a [{adj: simple}] test",
"Let's take the {adj}{!adj:short} test")
Console.WriteLine(t.Transform("This is a test"))
Console.WriteLine(t.Transform("This is a simple test"))
End Sub
End Module
Let's take the short test
Let's take the simple test Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("This is a [{adj: simple}] test", "Let's take the {adj}{!adj:short} test") Console.WriteLine(t.Transform("This is a test")) Console.WriteLine(t.Transform("This is a simple test")) End Sub End Module
ID: 195
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("a [{option: small | big }] test",
"a sample test{option: categorized as '{option}'}");
Console.WriteLine(t.Transform("This is a test."));
Console.WriteLine(t.Transform("This is a big test."));
Console.WriteLine(t.Transform("This is a small test."));
Console.WriteLine(t.Transform("This is a random test."));
This is a sample test.
This is a sample test categorized as 'big'.
This is a sample test categorized as 'small'.
This is a random test. using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("a [{option: small | big }] test", "a sample test{option: categorized as '{option}'}"); Console.WriteLine(t.Transform("This is a test.")); Console.WriteLine(t.Transform("This is a big test.")); Console.WriteLine(t.Transform("This is a small test.")); Console.WriteLine(t.Transform("This is a random test."));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("a [{option: small | big }] test",
"a sample test{option: categorized as '{option}'}");
cout << t.Transform("This is a test.") << endl;
cout << t.Transform("This is a big test.") << endl;
cout << t.Transform("This is a small test.") << endl;
cout << t.Transform("This is a random test.") << endl;
}
This is a sample test.
This is a sample test categorized as 'big'.
This is a sample test categorized as 'small'.
This is a random test. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("a [{option: small | big }] test", "a sample test{option: categorized as '{option}'}"); cout << t.Transform("This is a test.") << endl; cout << t.Transform("This is a big test.") << endl; cout << t.Transform("This is a small test.") << endl; cout << t.Transform("This is a random test.") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("a [{option: small | big }] test",
"a sample test{option: categorized as '{option}'}")
Console.WriteLine(t.Transform("This is a test."))
Console.WriteLine(t.Transform("This is a big test."))
Console.WriteLine(t.Transform("This is a small test."))
Console.WriteLine(t.Transform("This is a random test."))
End Sub
End Module
This is a sample test.
This is a sample test categorized as 'big'.
This is a sample test categorized as 'small'.
This is a random test. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("a [{option: small | big }] test", "a sample test{option: categorized as '{option}'}") Console.WriteLine(t.Transform("This is a test.")) Console.WriteLine(t.Transform("This is a big test.")) Console.WriteLine(t.Transform("This is a small test.")) Console.WriteLine(t.Transform("This is a random test.")) End Sub End Module
ID: 239
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("Statement: {val} [;]", "Found: {val}");
Console.WriteLine(t.Transform("Statement: x = 1;")); // Output: Found: x = 1
Console.WriteLine(t.Transform("Statement: y = 2")); // Output: Found: y = 2
Found: x = 1
Found: y = 2 using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("Statement: {val} [;]", "Found: {val}"); Console.WriteLine(t.Transform("Statement: x = 1;")); // Output: Found: x = 1 Console.WriteLine(t.Transform("Statement: y = 2")); // Output: Found: y = 2
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("Statement: {val} [;]", "Found: {val}");
cout << t.Transform("Statement: x = 1;") << endl; // Output: Found: x = 1
cout << t.Transform("Statement: y = 2") << endl; // Output: Found: y = 2
}
Found: x = 1
Found: y = 2 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("Statement: {val} [;]", "Found: {val}"); cout << t.Transform("Statement: x = 1;") << endl; // Output: Found: x = 1 cout << t.Transform("Statement: y = 2") << endl; // Output: Found: y = 2 }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("Statement: {val} [;]", "Found: {val}")
Console.WriteLine(t.Transform("Statement: x = 1;")) '// Output: Found: x = 1
Console.WriteLine(t.Transform("Statement: y = 2")) '// Output: Found: y = 2
End Sub
End Module
Found: x = 1
Found: y = 2 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("Statement: {val} [;]", "Found: {val}") Console.WriteLine(t.Transform("Statement: x = 1;")) '// Output: Found: x = 1 Console.WriteLine(t.Transform("Statement: y = 2")) '// Output: Found: y = 2 End Sub End Module
ID: 240
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
// Matches "First Last" OR "First Middle Last"
// Constraint Note: We use {name:1} to ensure each variable captures exactly one token.
// Replacement Note: We use {middle: {middle}} instead of just {middle} to prepend
// a space only if the middle name exists.
t.FromTo("Name: {first:1} [{middle:1}] {last:1}",
"User: {last}, {first}{middle: {middle}}");
Console.WriteLine(t.Transform("Name: John Doe"));
Console.WriteLine(t.Transform("Name: John Quincy Adams"));
User: Doe, John
User: Adams, John Quincy using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); // Matches "First Last" OR "First Middle Last" // Constraint Note: We use {name:1} to ensure each variable captures exactly one token. // Replacement Note: We use {middle: {middle}} instead of just {middle} to prepend // a space only if the middle name exists. t.FromTo("Name: {first:1} [{middle:1}] {last:1}", "User: {last}, {first}{middle: {middle}}"); Console.WriteLine(t.Transform("Name: John Doe")); Console.WriteLine(t.Transform("Name: John Quincy Adams"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
// Matches "First Last" OR "First Middle Last"
// Constraint Note: We use {name:1} to ensure each variable captures exactly one token.
// Replacement Note: We use {middle: {middle}} instead of just {middle} to prepend
// a space only if the middle name exists.
t.FromTo("Name: {first:1} [{middle:1}] {last:1}",
"User: {last}, {first}{middle: {middle}}");
cout << t.Transform("Name: John Doe") << endl;
cout << t.Transform("Name: John Quincy Adams") << endl;
}
User: Doe, John
User: Adams, John Quincy #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); // Matches "First Last" OR "First Middle Last" // Constraint Note: We use {name:1} to ensure each variable captures exactly one token. // Replacement Note: We use {middle: {middle}} instead of just {middle} to prepend // a space only if the middle name exists. t.FromTo("Name: {first:1} [{middle:1}] {last:1}", "User: {last}, {first}{middle: {middle}}"); cout << t.Transform("Name: John Doe") << endl; cout << t.Transform("Name: John Quincy Adams") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
'// Matches "First Last" OR "First Middle Last"
'// Constraint Note: We use {name:1} to ensure each variable captures exactly one token.
'// Replacement Note: We use {middle: {middle}} instead of just {middle} to prepend
'// a space only if the middle name exists.
t.FromTo("Name: {first:1} [{middle:1}] {last:1}",
"User: {last}, {first}{middle: {middle}}")
Console.WriteLine(t.Transform("Name: John Doe"))
Console.WriteLine(t.Transform("Name: John Quincy Adams"))
End Sub
End Module
User: Doe, John
User: Adams, John Quincy Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() '// Matches "First Last" OR "First Middle Last" '// Constraint Note: We use {name:1} to ensure each variable captures exactly one token. '// Replacement Note: We use {middle: {middle}} instead of just {middle} to prepend '// a space only if the middle name exists. t.FromTo("Name: {first:1} [{middle:1}] {last:1}", "User: {last}, {first}{middle: {middle}}") Console.WriteLine(t.Transform("Name: John Doe")) Console.WriteLine(t.Transform("Name: John Quincy Adams")) End Sub End Module
ID: 789
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("a [{txt}] b", "a, {txt:{txt}, }b");
Console.WriteLine(t.Transform("a b"));
Console.WriteLine(t.Transform("a x b"));
a, b
a, x, b using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("a [{txt}] b", "a, {txt:{txt}, }b"); Console.WriteLine(t.Transform("a b")); Console.WriteLine(t.Transform("a x b"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("a [{txt}] b", "a, {txt:{txt}, }b");
cout << t.Transform("a b") << endl;
cout << t.Transform("a x b") << endl;
}
a, b
a, x, b #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("a [{txt}] b", "a, {txt:{txt}, }b"); cout << t.Transform("a b") << endl; cout << t.Transform("a x b") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("a [{txt}] b", "a, {txt:{txt}, }b")
Console.WriteLine(t.Transform("a b"))
Console.WriteLine(t.Transform("a x b"))
End Sub
End Module
a, b
a, x, b Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("a [{txt}] b", "a, {txt:{txt}, }b") Console.WriteLine(t.Transform("a b")) Console.WriteLine(t.Transform("a x b")) End Sub End Module