uCalc String is Mutable Token-Aware Fluent Smart Intuitive Surgical
Upgrade your text manipulation. uCalc String is a sophisticated, mutable string object that replaces complex index math and fragile string slicing with a powerful, token-aware search and replace API. Build elegant, chainable text-processing pipelines in a single line of code.
The Smart String Engine
Standard native strings are immutable, making complex text manipulation a tedious chore of index tracking, substring extraction, and manual concatenation. Regular expression replacements, on the other hand, are character-blind and risky. uCalc String solves both problems. It operates on a "live view" model, allowing you to safely edit text in-place using a structural, token-aware engine. The library handles the heavy lifting of structural tracking under the hood, serving as the perfect companion to the Transformer for concise, on-the-fly data extraction and formatting.
Surgical Mutability
Modify text in-place without writing tedious, error-prone substring math. The engine handles the complex shifting and realignment for you.
Live Views
Extracting a substring returns a live window into the text. Changes made to the child view instantly update the parent string.
Token-Aware API
Safely manipulate text using structural boundaries (like words and quoted strings) rather than raw character counts.
uCalc String is Surgical
Complex text editing without the index math.
Native strings require tedious index tracking, manual Substring() calls, and clunky concatenation whenever you need to replace or shift text in the middle of a document. uCalc String abstracts away all of that fragility. While it does the heavy lifting of maintaining token boundaries and structural maps under the hood, your code remains perfectly clean. You can insert, delete, or replace text surgically within a document, and the library automatically handles the complex shifting and realigning for you, completely eliminating off-by-one errors.
To_uCalcString
ID: 154
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "if (x > 3) y = x * 2; else if(x == 5) y = x - 1;";
t.FromTo("1", "100");
t.Transform();
var Pattern = "if ({cond})";
Console.WriteLine(new uCalc.String(t).After(Pattern).Text);
Console.WriteLine(new uCalc.String(t).After(Pattern).After(Pattern));
var s = new uCalc.String();
s = "This is a test";
Console.WriteLine(new uCalc.Transformer(s).Text);
y = x * 2; else if(x == 5) y = x - 100;
y = x - 100;
This is a test using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Text = "if (x > 3) y = x * 2; else if(x == 5) y = x - 1;"; t.FromTo("1", "100"); t.Transform(); var Pattern = "if ({cond})"; Console.WriteLine(new uCalc.String(t).After(Pattern).Text); Console.WriteLine(new uCalc.String(t).After(Pattern).After(Pattern)); var s = new uCalc.String(); s = "This is a test"; Console.WriteLine(new uCalc.Transformer(s).Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Text("if (x > 3) y = x * 2; else if(x == 5) y = x - 1;");
t.FromTo("1", "100");
t.Transform();
auto Pattern = "if ({cond})";
cout << uCalc::String(t).After(Pattern).Text() << endl;
cout << uCalc::String(t).After(Pattern).After(Pattern) << endl;
uCalc::String s;
s = "This is a test";
cout << uCalc::Transformer(s).Text() << endl;
}
y = x * 2; else if(x == 5) y = x - 100;
y = x - 100;
This is a test #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Text("if (x > 3) y = x * 2; else if(x == 5) y = x - 1;"); t.FromTo("1", "100"); t.Transform(); auto Pattern = "if ({cond})"; cout << uCalc::String(t).After(Pattern).Text() << endl; cout << uCalc::String(t).After(Pattern).After(Pattern) << endl; uCalc::String s; s = "This is a test"; cout << uCalc::Transformer(s).Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Text = "if (x > 3) y = x * 2; else if(x == 5) y = x - 1;"
t.FromTo("1", "100")
t.Transform()
Dim Pattern = "if ({cond})"
Console.WriteLine(new uCalc.String(t).After(Pattern).Text)
Console.WriteLine(new uCalc.String(t).After(Pattern).After(Pattern))
Dim s As New uCalc.String()
s = "This is a test"
Console.WriteLine(new uCalc.Transformer(s).Text)
End Sub
End Module
y = x * 2; else if(x == 5) y = x - 100;
y = x - 100;
This is a test Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Text = "if (x > 3) y = x * 2; else if(x == 5) y = x - 1;" t.FromTo("1", "100") t.Transform() Dim Pattern = "if ({cond})" Console.WriteLine(new uCalc.String(t).After(Pattern).Text) Console.WriteLine(new uCalc.String(t).After(Pattern).After(Pattern)) Dim s As New uCalc.String() s = "This is a test" Console.WriteLine(new uCalc.Transformer(s).Text) End Sub End Module
uCalc String is Fluent
Editing with Live Views.
Say goodbye to multi-step string extraction code that clutters your logic with temporary variables. uCalc String uses a unique "live view" architecture. When you narrow your focus using navigational methods like After() or Between(), you aren't creating a disconnected copy. You get a live window into the parent string. Chain a Replace() directly onto that view, and the edits seamlessly flow back into the original document.
Demonstrating in-place modification with uCalc.String.Replace
ID: 227
using uCalcSoftware;
var uc = new uCalc();
uCalc.String text = "This is foo 1, foo 2, Foo 3, foo 4";
text.After("1").Before("3").Replace("foo", "bar"); // 'text' is now modified
Console.WriteLine(text);
This is foo 1, bar 2, bar 3, foo 4 using uCalcSoftware; var uc = new uCalc(); uCalc.String text = "This is foo 1, foo 2, Foo 3, foo 4"; text.After("1").Before("3").Replace("foo", "bar"); // 'text' is now modified Console.WriteLine(text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::String text = "This is foo 1, foo 2, Foo 3, foo 4";
text.After("1").Before("3").Replace("foo", "bar"); // 'text' is now modified
cout << text << endl;
}
This is foo 1, bar 2, bar 3, foo 4 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::String text = "This is foo 1, foo 2, Foo 3, foo 4"; text.After("1").Before("3").Replace("foo", "bar"); // 'text' is now modified cout << text << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim text As uCalc.String = "This is foo 1, foo 2, Foo 3, foo 4"
text.After("1").Before("3").Replace("foo", "bar") '// 'text' is now modified
Console.WriteLine(text)
End Sub
End Module
This is foo 1, bar 2, bar 3, foo 4 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim text As uCalc.String = "This is foo 1, foo 2, Foo 3, foo 4" text.After("1").Before("3").Replace("foo", "bar") '// 'text' is now modified Console.WriteLine(text) End Sub End Module
uCalc String is Token-Aware
Safe extraction that understands your data.
Standard string operations are blind; they only count characters. uCalc String operations count tokens. When you ask it to find a substring or extract text, the engine automatically respects the natural boundaries of quoted strings, brackets, and alphanumeric words. This structural safety prevents the accidental data corruption that plagues traditional string manipulation tools.
How to extract text that appears after a specific pattern using the String.After() method.
ID: 105
using uCalcSoftware;
var uc = new uCalc();
uCalc.String s = "This is just a test";
Console.WriteLine(s.After("is"));
s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;";
Console.WriteLine(s.After("if ({cond})"));
Console.WriteLine(s.After("if ({cond})").After("if ({cond})"));
Console.WriteLine(s.After("if ({cond})", 2)); // Finds text after 2nd match (same as above)
Console.WriteLine(s.After("NonExistingPattern")); // Nothing to display on this line
Console.WriteLine("----");
just a test
y = x * 2; else if(x == 5) y = x - 1;
y = x - 1;
y = x - 1;
---- using uCalcSoftware; var uc = new uCalc(); uCalc.String s = "This is just a test"; Console.WriteLine(s.After("is")); s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;"; Console.WriteLine(s.After("if ({cond})")); Console.WriteLine(s.After("if ({cond})").After("if ({cond})")); Console.WriteLine(s.After("if ({cond})", 2)); // Finds text after 2nd match (same as above) Console.WriteLine(s.After("NonExistingPattern")); // Nothing to display on this line Console.WriteLine("----");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::String s = "This is just a test";
cout << s.After("is") << endl;
s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;";
cout << s.After("if ({cond})") << endl;
cout << s.After("if ({cond})").After("if ({cond})") << endl;
cout << s.After("if ({cond})", 2) << endl; // Finds text after 2nd match (same as above)
cout << s.After("NonExistingPattern") << endl; // Nothing to display on this line
cout << "----" << endl;
}
just a test
y = x * 2; else if(x == 5) y = x - 1;
y = x - 1;
y = x - 1;
---- #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::String s = "This is just a test"; cout << s.After("is") << endl; s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;"; cout << s.After("if ({cond})") << endl; cout << s.After("if ({cond})").After("if ({cond})") << endl; cout << s.After("if ({cond})", 2) << endl; // Finds text after 2nd match (same as above) cout << s.After("NonExistingPattern") << endl; // Nothing to display on this line cout << "----" << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim s As uCalc.String = "This is just a test"
Console.WriteLine(s.After("is"))
s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;"
Console.WriteLine(s.After("if ({cond})"))
Console.WriteLine(s.After("if ({cond})").After("if ({cond})"))
Console.WriteLine(s.After("if ({cond})", 2)) '// Finds text after 2nd match (same as above)
Console.WriteLine(s.After("NonExistingPattern")) '// Nothing to display on this line
Console.WriteLine("----")
End Sub
End Module
just a test
y = x * 2; else if(x == 5) y = x - 1;
y = x - 1;
y = x - 1;
---- Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim s As uCalc.String = "This is just a test" Console.WriteLine(s.After("is")) s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;" Console.WriteLine(s.After("if ({cond})")) Console.WriteLine(s.After("if ({cond})").After("if ({cond})")) Console.WriteLine(s.After("if ({cond})", 2)) '// Finds text after 2nd match (same as above) Console.WriteLine(s.After("NonExistingPattern")) '// Nothing to display on this line Console.WriteLine("----") End Sub End Module
uCalc String is Smart
A native feel with zero boilerplate.
Despite its advanced, under-the-hood capabilities, integrating the library into your existing codebase feels entirely natural. Thanks to built-in implicit conversions and shortcut notations, you can assign, read, and manipulate uCalc String objects exactly as if they were native string primitives, bringing powerful capabilities to your code with virtually zero learning curve.
Shows how implicit conversions simplify using uCalc objects for text manipulation.
ID: 804
using uCalcSoftware;
var uc = new uCalc();
uCalc.Transformer t;
uCalc.String s;
// Implicitly set the Text property
t = "Source text with foo.";
s = "bar";
// Use the objects in a standard way
t.FromTo("foo", s.Text);
t.Transform();
// Implicitly get the Text property
Console.WriteLine(t);
Source text with bar. using uCalcSoftware; var uc = new uCalc(); uCalc.Transformer t; uCalc.String s; // Implicitly set the Text property t = "Source text with foo."; s = "bar"; // Use the objects in a standard way t.FromTo("foo", s.Text); t.Transform(); // Implicitly get the Text property Console.WriteLine(t);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
uCalc::String s;
// Implicitly set the Text property
t = "Source text with foo.";
s = "bar";
// Use the objects in a standard way
t.FromTo("foo", s.Text());
t.Transform();
// Implicitly get the Text property
cout << t << endl;
}
Source text with bar. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; uCalc::String s; // Implicitly set the Text property t = "Source text with foo."; s = "bar"; // Use the objects in a standard way t.FromTo("foo", s.Text()); t.Transform(); // Implicitly get the Text property cout << t << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
Dim s As New uCalc.String()
'// Implicitly set the Text property
t = "Source text with foo."
s = "bar"
'// Use the objects in a standard way
t.FromTo("foo", s.Text)
t.Transform()
'// Implicitly get the Text property
Console.WriteLine(t)
End Sub
End Module
Source text with bar. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() Dim s As New uCalc.String() '// Implicitly set the Text property t = "Source text with foo." s = "bar" '// Use the objects in a standard way t.FromTo("foo", s.Text) t.Transform() '// Implicitly get the Text property Console.WriteLine(t) End Sub End Module