A practical example demonstrating how to extract an error message from a log entry and then chain another operation on the result.

ID: 1164

See: After
				
					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.
				
					#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
   }
}
				
			
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
				
			
Original log: INFO: Task complete. ERROR: Resource not found.
Modified details: Resource not found.