Shows how implicit conversions simplify using uCalc objects for text manipulation.
ID: 804
See: Shortcut notations
using uCalcSoftware;
var uc = new uCalc();
uCalc.Transformer t;
uCalc.String s;
// Implicitly set the Text property
t = "Source text with foo.";
s = "bar";
// Use the objects in a standard way
t.FromTo("foo", s.Text);
t.Transform();
// Implicitly get the Text property
Console.WriteLine(t);
Source text with bar. using uCalcSoftware; var uc = new uCalc(); uCalc.Transformer t; uCalc.String s; // Implicitly set the Text property t = "Source text with foo."; s = "bar"; // Use the objects in a standard way t.FromTo("foo", s.Text); t.Transform(); // Implicitly get the Text property Console.WriteLine(t);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
uCalc::String s;
// Implicitly set the Text property
t = "Source text with foo.";
s = "bar";
// Use the objects in a standard way
t.FromTo("foo", s.Text());
t.Transform();
// Implicitly get the Text property
cout << t << endl;
}
Source text with bar. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; uCalc::String s; // Implicitly set the Text property t = "Source text with foo."; s = "bar"; // Use the objects in a standard way t.FromTo("foo", s.Text()); t.Transform(); // Implicitly get the Text property cout << t << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
Dim s As New uCalc.String()
'// Implicitly set the Text property
t = "Source text with foo."
s = "bar"
'// Use the objects in a standard way
t.FromTo("foo", s.Text)
t.Transform()
'// Implicitly get the Text property
Console.WriteLine(t)
End Sub
End Module
Source text with bar. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() Dim s As New uCalc.String() '// Implicitly set the Text property t = "Source text with foo." s = "bar" '// Use the objects in a standard way t.FromTo("foo", s.Text) t.Transform() '// Implicitly get the Text property Console.WriteLine(t) End Sub End Module