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.
Product:
Class:
Creates a live, modifiable view of the substring that follows a specified pattern match.
A new uCalc.String object that is a live, modifiable view into the portion of the parent string that comes after the specified pattern match. Returns an empty string object if the pattern is not found or if nothing follows it.
The After method finds the nth occurrence of a given pattern and returns a new uCalc.String object representing all the text that follows it. This is a fundamental tool for parsing data and is part of uCalc.String's fluent, chainable API.
Note: This method may be renamed to
StartAfterin a future version for better consistency with the Rule.StartAfter property.
The most important feature of this method is that it does not return a simple, disconnected substring. Instead, it returns a live, modifiable view into the parent string. This means:
pattern: The uCalc pattern to search for. This can be a simple literal or a complex pattern with variables.nth: A 1-based index specifying which occurrence of the pattern to find. The default value of 1 finds the first match.If the specified pattern is not found, or if nothing comes after it, the method returns an empty uCalc.String object. No error is raised.
In a standard language like C#, you would typically find the end position of a match and then create a new substring.
C# Manual Approach:
string text = "ID: 12345";string prefix = "ID: ";int startIndex = text.IndexOf(prefix);if (startIndex != -1){ string value = text.Substring(startIndex + prefix.Length); // 'value' is now a new, disconnected string "12345"}This approach is imperative and creates disconnected data. uCalc.String provides a more powerful, declarative, and integrated solution:
The uCalc Advantage:csharp
var s = new uCalc.String("ID: 12345");
var valueView = s.After("ID: "); // Returns a live view
// Modifying the view changes the original string 's'
valueView.Replace("12345", "CHANGED");
Console.WriteLine(s); // Output: ID: CHANGED
This ability to create live, chainable views is a key differentiator, enabling a more fluid and powerful style of text manipulation that is not possible with standard string libraries.
ID: 1163
using uCalcSoftware;
var uc = new uCalc();
using (var s = new uCalc.String("ID: 12345")) {
// Get the text after the "ID: " prefix
var value = s.After("ID: ");
Console.WriteLine(value);
}
12345 using uCalcSoftware; var uc = new uCalc(); using (var s = new uCalc.String("ID: 12345")) { // Get the text after the "ID: " prefix var value = s.After("ID: "); Console.WriteLine(value); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::String s("ID: 12345");
s.Owned(); // Causes s to be released when it goes out of scope
// Get the text after the "ID: " prefix
auto value = s.After("ID: ");
cout << value << endl;
}
}
12345 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::String s("ID: 12345"); s.Owned(); // Causes s to be released when it goes out of scope // Get the text after the "ID: " prefix auto value = s.After("ID: "); cout << value << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using s As New uCalc.String("ID: 12345")
'// Get the text after the "ID: " prefix
Dim value = s.After("ID: ")
Console.WriteLine(value)
End Using
End Sub
End Module
12345 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using s As New uCalc.String("ID: 12345") '// Get the text after the "ID: " prefix Dim value = s.After("ID: ") Console.WriteLine(value) End Using End Sub End Module
ID: 1164
using uCalcSoftware;
var uc = new uCalc();
using (var log = new uCalc.String("INFO: Task complete. ERROR: File not found.")) {
// Chain After() to isolate the error, then Replace() to modify it.
var errorDetails = log.After("ERROR: ").Replace("File", "Resource");
Console.WriteLine($"Original log: {log}"); // The original string is modified in-place
Console.WriteLine($"Modified details:{errorDetails}"); // The view reflects the change
}
Original log: INFO: Task complete. ERROR: Resource not found.
Modified details: Resource not found. using uCalcSoftware; var uc = new uCalc(); using (var log = new uCalc.String("INFO: Task complete. ERROR: File not found.")) { // Chain After() to isolate the error, then Replace() to modify it. var errorDetails = log.After("ERROR: ").Replace("File", "Resource"); Console.WriteLine($"Original log: {log}"); // The original string is modified in-place Console.WriteLine($"Modified details:{errorDetails}"); // The view reflects the change }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::String log("INFO: Task complete. ERROR: File not found.");
log.Owned(); // Causes log to be released when it goes out of scope
// Chain After() to isolate the error, then Replace() to modify it.
auto errorDetails = log.After("ERROR: ").Replace("File", "Resource");
cout << "Original log: " << log << endl; // The original string is modified in-place
cout << "Modified details:" << errorDetails << endl; // The view reflects the change
}
}
Original log: INFO: Task complete. ERROR: Resource not found.
Modified details: Resource not found. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::String log("INFO: Task complete. ERROR: File not found."); log.Owned(); // Causes log to be released when it goes out of scope // Chain After() to isolate the error, then Replace() to modify it. auto errorDetails = log.After("ERROR: ").Replace("File", "Resource"); cout << "Original log: " << log << endl; // The original string is modified in-place cout << "Modified details:" << errorDetails << endl; // The view reflects the change } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using log As New uCalc.String("INFO: Task complete. ERROR: File not found.")
'// Chain After() to isolate the error, then Replace() to modify it.
Dim errorDetails = log.After("ERROR: ").Replace("File", "Resource")
Console.WriteLine($"Original log: {log}") '// The original string is modified in-place
Console.WriteLine($"Modified details:{errorDetails}") '// The view reflects the change
End Using
End Sub
End Module
Original log: INFO: Task complete. ERROR: Resource not found.
Modified details: Resource not found. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using log As New uCalc.String("INFO: Task complete. ERROR: File not found.") '// Chain After() to isolate the error, then Replace() to modify it. Dim errorDetails = log.After("ERROR: ").Replace("File", "Resource") Console.WriteLine($"Original log: {log}") '// The original string is modified in-place Console.WriteLine($"Modified details:{errorDetails}") '// The view reflects the change End Using End Sub End Module
ID: 1165
using uCalcSoftware;
var uc = new uCalc();
using (var s = new uCalc.String("A B C")) {
// Case 1: Pattern is at the end. Should return an empty string.
Console.Write("After 'C': '");
Console.Write(s.After("C"));
Console.WriteLine("'");
// Case 2: Pattern does not exist. Should return an empty string.
Console.Write("After 'D': '");
Console.Write(s.After("D"));
Console.WriteLine("'");
// Case 3: Get text after the first word.
Console.Write("After 'A': '");
Console.Write(s.After("A"));
Console.WriteLine("'");
}
After 'C': ''
After 'D': ''
After 'A': ' B C' using uCalcSoftware; var uc = new uCalc(); using (var s = new uCalc.String("A B C")) { // Case 1: Pattern is at the end. Should return an empty string. Console.Write("After 'C': '"); Console.Write(s.After("C")); Console.WriteLine("'"); // Case 2: Pattern does not exist. Should return an empty string. Console.Write("After 'D': '"); Console.Write(s.After("D")); Console.WriteLine("'"); // Case 3: Get text after the first word. Console.Write("After 'A': '"); Console.Write(s.After("A")); Console.WriteLine("'"); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::String s("A B C");
s.Owned(); // Causes s to be released when it goes out of scope
// Case 1: Pattern is at the end. Should return an empty string.
cout << "After 'C': '";
cout << s.After("C");
cout << "'" << endl;
// Case 2: Pattern does not exist. Should return an empty string.
cout << "After 'D': '";
cout << s.After("D");
cout << "'" << endl;
// Case 3: Get text after the first word.
cout << "After 'A': '";
cout << s.After("A");
cout << "'" << endl;
}
}
After 'C': ''
After 'D': ''
After 'A': ' B C' #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::String s("A B C"); s.Owned(); // Causes s to be released when it goes out of scope // Case 1: Pattern is at the end. Should return an empty string. cout << "After 'C': '"; cout << s.After("C"); cout << "'" << endl; // Case 2: Pattern does not exist. Should return an empty string. cout << "After 'D': '"; cout << s.After("D"); cout << "'" << endl; // Case 3: Get text after the first word. cout << "After 'A': '"; cout << s.After("A"); cout << "'" << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using s As New uCalc.String("A B C")
'// Case 1: Pattern is at the end. Should return an empty string.
Console.Write("After 'C': '")
Console.Write(s.After("C"))
Console.WriteLine("'")
'// Case 2: Pattern does not exist. Should return an empty string.
Console.Write("After 'D': '")
Console.Write(s.After("D"))
Console.WriteLine("'")
'// Case 3: Get text after the first word.
Console.Write("After 'A': '")
Console.Write(s.After("A"))
Console.WriteLine("'")
End Using
End Sub
End Module
After 'C': ''
After 'D': ''
After 'A': ' B C' Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using s As New uCalc.String("A B C") '// Case 1: Pattern is at the end. Should return an empty string. Console.Write("After 'C': '") Console.Write(s.After("C")) Console.WriteLine("'") '// Case 2: Pattern does not exist. Should return an empty string. Console.Write("After 'D': '") Console.Write(s.After("D")) Console.WriteLine("'") '// Case 3: Get text after the first word. Console.Write("After 'A': '") Console.Write(s.After("A")) Console.WriteLine("'") End Using End Sub End Module
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