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.

StartingFrom

Method

Product: 

Class: 

Creates a live, modifiable view of the substring that begins with and includes a specified pattern match.

Syntax

StartingFrom(string, int)

Parameters

startPattern
string
The pattern marking the beginning of the substring. The returned view will include the text of this match.
occurrence
int
(Default = 1)
The 1-based occurrence of the pattern to find. For example, a value of 2 finds the second match.

Return

String

A new uCalc.String object that is a live, modifiable view into the portion of the parent string that starts with the specified pattern match. Returns an empty string object if the pattern is not found.

Remarks

✂️ Extracting Text From a Pattern (Inclusive)

The StartingFrom method finds the nth occurrence of a given pattern and returns a new uCalc.String object representing all the text from that point to the end of the string. This is a fundamental tool for parsing data and is part of uCalc.String's fluent, chainable API.

StartingFrom vs. After: The Inclusive Advantage

This method's key distinction is its inclusive behavior. The returned substring includes the text of the pattern match itself.

  • StartingFrom("A") on "A B C" returns "A B C".
  • After("A") on "A B C" returns " B C".

Choose StartingFrom when you need the delimiter as part of the result, and After when you only need what follows it.

✨ The "Live View" Concept

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:

  • Any modifications made to the child string (the returned view) will directly affect the content of the original parent string.
  • This allows for powerful, in-place editing of specific sections of a larger document without the overhead of creating and rejoining substrings.

💡 Why uCalc? (Comparative Analysis)

In a standard language like C#, you would typically find the starting 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);    // 'value' is now a new, disconnected string "ID: 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.StartingFrom("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.

Examples

A simple example extracting the latter part of a sentence starting from a specific word.

ID: 1278

				
					using uCalcSoftware;

var uc = new uCalc();
using (var s = new uCalc.String("This is just a test")) {
   
   // Returns a view from 'just' to the end
   var result = s.StartingFrom("just");

   Console.WriteLine(result);
}
				
			
just a test
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   {
      uCalc::String s("This is just a test");
      s.Owned(); // Causes s to be released when it goes out of scope

      // Returns a view from 'just' to the end
      auto result = s.StartingFrom("just");

      cout << result << endl;
   }
}
				
			
just a test
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Using s As New uCalc.String("This is just a test")
         
         '// Returns a view from 'just' to the end
         Dim result = s.StartingFrom("just")
         
         Console.WriteLine(result)
      End Using
   End Sub
End Module
				
			
just a test
Extracts all log entries from the second 'ERROR' onwards, demonstrating how the `occurrence` parameter skips initial matches.

ID: 1279

				
					using uCalcSoftware;

var uc = new uCalc();
using (var log = new uCalc.String("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.")) {
   
   // Find the second occurrence of "ERROR" and get everything after it.
   var remainingLog = log.StartingFrom("ERROR", 2);

   Console.WriteLine(remainingLog);
}
				
			
ERROR: Fail 2.
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   {
      uCalc::String log("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.");
      log.Owned(); // Causes log to be released when it goes out of scope

      // Find the second occurrence of "ERROR" and get everything after it.
      auto remainingLog = log.StartingFrom("ERROR", 2);

      cout << remainingLog << endl;
   }
}
				
			
ERROR: Fail 2.
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Using log As New uCalc.String("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.")
         
         '// Find the second occurrence of "ERROR" and get everything after it.
         Dim remainingLog = log.StartingFrom("ERROR", 2)
         
         Console.WriteLine(remainingLog)
      End Using
   End Sub
End Module
				
			
ERROR: Fail 2.