A simple find-and-replace transformation to replace all occurrences of a word.
ID: 1144
using uCalcSoftware;
var uc = new uCalc();
using (var t = new uCalc.Transformer()) {
// Define a simple replacement rule
t.FromTo("Hello", "Greetings");
// Execute the transformation on an input string
Console.WriteLine(t.Transform("Hello World, and Hello again."));
}
Greetings World, and Greetings again. using uCalcSoftware; var uc = new uCalc(); using (var t = new uCalc.Transformer()) { // Define a simple replacement rule t.FromTo("Hello", "Greetings"); // Execute the transformation on an input string Console.WriteLine(t.Transform("Hello World, and Hello again.")); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::Transformer t;
t.Owned(); // Causes t to be released when it goes out of scope
// Define a simple replacement rule
t.FromTo("Hello", "Greetings");
// Execute the transformation on an input string
cout << t.Transform("Hello World, and Hello again.") << endl;
}
}
Greetings World, and Greetings again. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::Transformer t; t.Owned(); // Causes t to be released when it goes out of scope // Define a simple replacement rule t.FromTo("Hello", "Greetings"); // Execute the transformation on an input string cout << t.Transform("Hello World, and Hello again.") << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using t As New uCalc.Transformer()
'// Define a simple replacement rule
t.FromTo("Hello", "Greetings")
'// Execute the transformation on an input string
Console.WriteLine(t.Transform("Hello World, and Hello again."))
End Using
End Sub
End Module
Greetings World, and Greetings again. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using t As New uCalc.Transformer() '// Define a simple replacement rule t.FromTo("Hello", "Greetings") '// Execute the transformation on an input string Console.WriteLine(t.Transform("Hello World, and Hello again.")) End Using End Sub End Module