uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
{@dq}
Product:
Class:
Remarks
Description: A shortcut directive that matches the double-quote character " (specifically the _Token_QuoteChar_Double token).
The {@dq} directive is used within a uCalc::Transformer as a specialized matcher for the double-quote character. Conceptually, it functions similarly to {@Bracket} (Topic 803), serving as a structural anchor rather than a content matcher.
Structural Role
Unlike {@String}—which captures an entire quoted string—{@dq} matches only the quote character itself. This is useful when you need to redefine the boundaries of a string or perform transformations that affect the delimiters specifically.
- Internal Shortcut: This is equivalent to calling
{@Token(_Token_QuoteChar_Double)}. - Delimiter vs. Data: Use
{@dq}to match the quote; use{@String}or{@StringDQ}to match the enclosed text.
Inverse Matching with !
The inversion operator ! can be applied to this directive:
{@dq}: Matches the double-quote character.{!dq}: Matches any token that is not a double-quote character.
Examples
Replacing double quotes with single quotes.
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@dq}", "'");
Console.WriteLine(t.Transform("""
print "Hello"
"""));
print 'Hello' using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("{@dq}", "'"); Console.WriteLine(t.Transform(""" print "Hello" """));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("{@dq}", "'");
cout << t.Transform(R"(print "Hello")") << endl;
}
print 'Hello' #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@dq}", "'"); cout << t.Transform(R"(print "Hello")") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("{@dq}", "'")
Console.WriteLine(t.Transform("print ""Hello"""))
End Sub
End Module
print 'Hello' Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("{@dq}", "'") Console.WriteLine(t.Transform("print ""Hello""")) End Sub End Module
(Real World: Escaping Helper) Finding double quotes to manually insert an escape backslash before them.
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@dq}", """
\"
""");
string input = """
Said "Hello"
""";
Console.WriteLine(t.Transform(input));
Said \"Hello\" using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("{@dq}", """ \" """); string input = """ Said "Hello" """; Console.WriteLine(t.Transform(input));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("{@dq}", R"(\")");
string input = R"(Said "Hello")";
cout << t.Transform(input) << endl;
}
Said \"Hello\" #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@dq}", R"(\")"); string input = R"(Said "Hello")"; 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()
t.FromTo("{@dq}", "\""")
Dim input As String = "Said ""Hello"""
Console.WriteLine(t.Transform(input))
End Sub
End Module
Said \"Hello\" Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("{@dq}", "\""") Dim input As String = "Said ""Hello""" Console.WriteLine(t.Transform(input)) End Sub End Module