A practical example of parsing a value from a simple key-value pair in a configuration string.

ID: 1273

				
					using uCalcSoftware;

var uc = new uCalc();
using (var s = new uCalc.String("User: admin; Role: user; Department: Sales;")) {
   
   // Extract the text between 'Department: ' and the trailing semicolon
   var department = s.Between("Department: ", ";");

   Console.WriteLine($"Department is '{department}'");
}
				
			
Department is ' Sales'
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   {
      uCalc::String s("User: admin; Role: user; Department: Sales;");
      s.Owned(); // Causes s to be released when it goes out of scope

      // Extract the text between 'Department: ' and the trailing semicolon
      auto department = s.Between("Department: ", ";");

      cout << "Department is '" << department << "'" << endl;
   }
}
				
			
Department is ' Sales'
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Using s As New uCalc.String("User: admin; Role: user; Department: Sales;")
         
         '// Extract the text between 'Department: ' and the trailing semicolon
         Dim department = s.Between("Department: ", ";")
         
         Console.WriteLine($"Department is '{department}'")
      End Using
   End Sub
End Module
				
			
Department is ' Sales'