Shows the creation of a uCalc.String and its use of a fluent, token-aware API to modify text in-place.
ID: 1336
using uCalcSoftware;
var uc = new uCalc();
// 1. Create a uCalc.String with a parent uCalc instance
using (var s = new uCalc.String(uc, "The user is .")) {
// 2. Use the fluent, token-aware API
s.After("is").Between("<", ">").ToUpper();
// 3. The original string is modified in-place
Console.WriteLine(s);
};
The user is <ADMIN>. using uCalcSoftware; var uc = new uCalc(); // 1. Create a uCalc.String with a parent uCalc instance using (var s = new uCalc.String(uc, "The user is <admin>.")) { // 2. Use the fluent, token-aware API s.After("is").Between("<", ">").ToUpper(); // 3. The original string is modified in-place Console.WriteLine(s); };
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// 1. Create a uCalc.String with a parent uCalc instance
{
uCalc::String s(uc, "The user is .");
s.Owned(); // Causes s to be released when it goes out of scope
// 2. Use the fluent, token-aware API
s.After("is").Between("<", ">").ToUpper();
// 3. The original string is modified in-place
cout << s << endl;
};
}
The user is <ADMIN>. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // 1. Create a uCalc.String with a parent uCalc instance { uCalc::String s(uc, "The user is <admin>."); s.Owned(); // Causes s to be released when it goes out of scope // 2. Use the fluent, token-aware API s.After("is").Between("<", ">").ToUpper(); // 3. The original string is modified in-place cout << s << endl; }; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// 1. Create a uCalc.String with a parent uCalc instance
Using s As New uCalc.String(uc, "The user is .")
'// 2. Use the fluent, token-aware API
s.After("is").Between("<", ">").ToUpper()
'// 3. The original string is modified in-place
Console.WriteLine(s)
End Using
End Sub
End Module
The user is <ADMIN>. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// 1. Create a uCalc.String with a parent uCalc instance Using s As New uCalc.String(uc, "The user is <admin>.") '// 2. Use the fluent, token-aware API s.After("is").Between("<", ">").ToUpper() '// 3. The original string is modified in-place Console.WriteLine(s) End Using End Sub End Module