Demonstrates using the Text property with implicit conversions (shortcuts) to parse a simple config string.

ID: 1133

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();

// Implicitly set the Text property by assigning a string to the object
t = "user=admin; level=9; theme=dark;";

// Define a rule to extract the user value
t.FromTo("user={name};", "Username: {name}");
t.Transform();

// Implicitly get the Text property by using the object in a string context
string result = t;
Console.WriteLine(result);
				
			
Username: admin level=9; theme=dark;
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;

   // Implicitly set the Text property by assigning a string to the object
   t = "user=admin; level=9; theme=dark;";

   // Define a rule to extract the user value
   t.FromTo("user={name};", "Username: {name}");
   t.Transform();

   // Implicitly get the Text property by using the object in a string context
   string result = t;
   cout << result << endl;
}
				
			
Username: admin level=9; theme=dark;
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      
      '// Implicitly set the Text property by assigning a string to the object
      t = "user=admin; level=9; theme=dark;"
      
      '// Define a rule to extract the user value
      t.FromTo("user={name};", "Username: {name}")
      t.Transform()
      
      '// Implicitly get the Text property by using the object in a string context
      Dim result As String = t
      Console.WriteLine(result)
   End Sub
End Module
				
			
Username: admin level=9; theme=dark;