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.
Description: A category matcher that identifies any token defined as a string literal, supporting single, double, and triple quotes, as well as interpolated strings.
The {@String} directive is the primary tool for matching text literals in a uCalc::Transformer. It handles the structural complexity of delimiters and escaping automatically.
'Single', "Double", or """Triple""" quoted blocks.$"{expression}" patterns. Note that for pattern matching, the content within the braces { } is captured based on balanced syntax; it does not require the internal identifiers to be defined unless the expression is being evaluated.While {@String} captures any string literal, you can use more specific variants if your logic requires it:
{@dqs}: Matches only double-quoted strings.{@sqs}: Matches only single-quoted strings.{@String}: Matches any string.!The universal inversion operator ! can be applied to this category:
{@String}: Matches any string literal.{!String}: Matches any token that is not a string (e.g., numbers, identifiers, or operators).When capturing a string with a named variable (e.g., {@String:txt}), the captured value includes the surrounding quotes. uCalc provides a powerful shortcut to access only the inner content:
{txt(0)}: Returns the full string with quotes (e.g., "Hello").{txt(1)}: Returns the "inner" content without quotes (e.g., Hello). {txt} defaults to {txt(1)}This is particularly useful when converting code to data formats (like XML or JSON) where delimiters must be stripped or changed.
{@String} leverages the lexer's pre-defined knowledge of where a string starts and ends, ensuring perfect accuracy even with nested quotes or escape characters.ID: 176
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("{@String:txt}", "<>");
t.FromTo("{@Number:MyNum}", "");
t.FromTo("{@Bracket:MyBrack}", "");
t.FromTo("{@CloseBracket:CloseBr}", "");
t.FromTo("{@StatementSeparator:Sep}", "");
t.FromTo("{@Alphanumeric:alpha}", "");
t.FromTo("{@Whitespace:ws}", "");
t.FromTo("{@Reducible:r}", "");
t.FromTo("{@Newline}", "");
var s = """
This is 55.2*6 "Hello world";
'Single quote'(parenth)
""";
Console.WriteLine(t.Filter(s).Matches.Text);
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)> using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>"); t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>"); t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>"); t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>"); t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>"); t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>"); t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>"); t.FromTo("{@Reducible:r}", "<Reducible={r}>"); t.FromTo("{@Newline}", "<New line{@Newline}>"); var s = """ This is 55.2*6 "Hello world"; 'Single quote'(parenth) """; Console.WriteLine(t.Filter(s).Matches.Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("{@String:txt}", "<>");
t.FromTo("{@Number:MyNum}", "");
t.FromTo("{@Bracket:MyBrack}", "");
t.FromTo("{@CloseBracket:CloseBr}", "");
t.FromTo("{@StatementSeparator:Sep}", "");
t.FromTo("{@Alphanumeric:alpha}", "");
t.FromTo("{@Whitespace:ws}", "");
t.FromTo("{@Reducible:r}", "");
t.FromTo("{@Newline}", "");
auto s = R"(This is 55.2*6 "Hello world";
'Single quote'(parenth))";
cout << t.Filter(s).Matches().Text() << endl;
}
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)> #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>"); t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>"); t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>"); t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>"); t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>"); t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>"); t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>"); t.FromTo("{@Reducible:r}", "<Reducible={r}>"); t.FromTo("{@Newline}", "<New line{@Newline}>"); auto s = R"(This is 55.2*6 "Hello world"; 'Single quote'(parenth))"; cout << t.Filter(s).Matches().Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("{@String:txt}", "<>")
t.FromTo("{@Number:MyNum}", "")
t.FromTo("{@Bracket:MyBrack}", "")
t.FromTo("{@CloseBracket:CloseBr}", "")
t.FromTo("{@StatementSeparator:Sep}", "")
t.FromTo("{@Alphanumeric:alpha}", "")
t.FromTo("{@Whitespace:ws}", "")
t.FromTo("{@Reducible:r}", "")
t.FromTo("{@Newline}", "")
Dim s = "This is 55.2*6 ""Hello world"";
'Single quote'(parenth)"
Console.WriteLine(t.Filter(s).Matches.Text)
End Sub
End Module
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)> Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>") t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>") t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>") t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>") t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>") t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>") t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>") t.FromTo("{@Reducible:r}", "<Reducible={r}>") t.FromTo("{@Newline}", "<New line{@Newline}>") Dim s = "This is 55.2*6 ""Hello world""; 'Single quote'(parenth)" Console.WriteLine(t.Filter(s).Matches.Text) End Sub End Module
ID: 894
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Capture the string and show both versions in the replacement
t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}");
Console.WriteLine(t.Transform("'uCalc'"));
With: 'uCalc', Without: uCalc, Default: uCalc using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Capture the string and show both versions in the replacement t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}"); Console.WriteLine(t.Transform("'uCalc'"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Capture the string and show both versions in the replacement
t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}");
cout << t.Transform("'uCalc'") << endl;
}
With: 'uCalc', Without: uCalc, Default: uCalc #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Capture the string and show both versions in the replacement t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}"); cout << t.Transform("'uCalc'") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Capture the string and show both versions in the replacement
t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}")
Console.WriteLine(t.Transform("'uCalc'"))
End Sub
End Module
With: 'uCalc', Without: uCalc, Default: uCalc Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Capture the string and show both versions in the replacement t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}") Console.WriteLine(t.Transform("'uCalc'")) End Sub End Module
ID: 895
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Use {s(1)} to get just the text inside the quotes
t.FromTo("msg = {@String:s}", "{s(1)} ");
string input = """
msg = "Welcome to uCalc!"
""";
Console.WriteLine(t.Transform(input));
<message>Welcome to uCalc!</message> using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Use {s(1)} to get just the text inside the quotes t.FromTo("msg = {@String:s}", "<message>{s(1)}</message>"); string input = """ msg = "Welcome to uCalc!" """; Console.WriteLine(t.Transform(input));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Use {s(1)} to get just the text inside the quotes
t.FromTo("msg = {@String:s}", "{s(1)} ");
string input = R"(msg = "Welcome to uCalc!")";
cout << t.Transform(input) << endl;
}
<message>Welcome to uCalc!</message> #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Use {s(1)} to get just the text inside the quotes t.FromTo("msg = {@String:s}", "<message>{s(1)}</message>"); string input = R"(msg = "Welcome to uCalc!")"; cout << t.Transform(input) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Use {s(1)} to get just the text inside the quotes
t.FromTo("msg = {@String:s}", "{s(1)} ")
Dim input As String = "msg = ""Welcome to uCalc!"""
Console.WriteLine(t.Transform(input))
End Sub
End Module
<message>Welcome to uCalc!</message> Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Use {s(1)} to get just the text inside the quotes t.FromTo("msg = {@String:s}", "<message>{s(1)}</message>") Dim input As String = "msg = ""Welcome to uCalc!""" Console.WriteLine(t.Transform(input)) End Sub End Module
ID: 896
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Replace every string literal with a placeholder
t.FromTo("{@String}", """
"[REDACTED]"
""");
string log = """
UserLogin(id: 101, pass: 'secret123', name: "Admin")
""";
Console.WriteLine(t.Transform(log));
UserLogin(id: 101, pass: "[REDACTED]", name: "[REDACTED]") using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Replace every string literal with a placeholder t.FromTo("{@String}", """ "[REDACTED]" """); string log = """ UserLogin(id: 101, pass: 'secret123', name: "Admin") """; Console.WriteLine(t.Transform(log));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Replace every string literal with a placeholder
t.FromTo("{@String}", R"("[REDACTED]")");
string log = R"(UserLogin(id: 101, pass: 'secret123', name: "Admin"))";
cout << t.Transform(log) << endl;
}
UserLogin(id: 101, pass: "[REDACTED]", name: "[REDACTED]") #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Replace every string literal with a placeholder t.FromTo("{@String}", R"("[REDACTED]")"); string log = R"(UserLogin(id: 101, pass: 'secret123', name: "Admin"))"; cout << t.Transform(log) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Replace every string literal with a placeholder
t.FromTo("{@String}", """[REDACTED]""")
Dim log As String = "UserLogin(id: 101, pass: 'secret123', name: ""Admin"")"
Console.WriteLine(t.Transform(log))
End Sub
End Module
UserLogin(id: 101, pass: "[REDACTED]", name: "[REDACTED]") Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Replace every string literal with a placeholder t.FromTo("{@String}", """[REDACTED]""") Dim log As String = "UserLogin(id: 101, pass: 'secret123', name: ""Admin"")" Console.WriteLine(t.Transform(log)) End Sub End Module