A simple demonstration of defining a token in one transformer and reusing it in another.
ID: 1003
See: Add(Item)
using uCalcSoftware;
var uc = new uCalc();
var t1 = new uCalc.Transformer();
var t2 = new uCalc.Transformer();
// Define a custom token in the first transformer
var customToken = t1.Tokens.Add("###", TokenType.Generic);
// Import the token definition into the second transformer
t2.Tokens.Add(customToken);
t2.FromTo("###", "MATCH");
Console.WriteLine($"t2 can now find '###': {t2.Transform("Test ### Test")}");
t2 can now find '###': Test MATCH Test using uCalcSoftware; var uc = new uCalc(); var t1 = new uCalc.Transformer(); var t2 = new uCalc.Transformer(); // Define a custom token in the first transformer var customToken = t1.Tokens.Add("###", TokenType.Generic); // Import the token definition into the second transformer t2.Tokens.Add(customToken); t2.FromTo("###", "MATCH"); Console.WriteLine($"t2 can now find '###': {t2.Transform("Test ### Test")}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t1;
uCalc::Transformer t2;
// Define a custom token in the first transformer
auto customToken = t1.Tokens().Add("###", TokenType::Generic);
// Import the token definition into the second transformer
t2.Tokens().Add(customToken);
t2.FromTo("###", "MATCH");
cout << "t2 can now find '###': " << t2.Transform("Test ### Test") << endl;
}
t2 can now find '###': Test MATCH Test #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t1; uCalc::Transformer t2; // Define a custom token in the first transformer auto customToken = t1.Tokens().Add("###", TokenType::Generic); // Import the token definition into the second transformer t2.Tokens().Add(customToken); t2.FromTo("###", "MATCH"); cout << "t2 can now find '###': " << t2.Transform("Test ### Test") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t1 As New uCalc.Transformer()
Dim t2 As New uCalc.Transformer()
'// Define a custom token in the first transformer
Dim customToken = t1.Tokens.Add("###", TokenType.Generic)
'// Import the token definition into the second transformer
t2.Tokens.Add(customToken)
t2.FromTo("###", "MATCH")
Console.WriteLine($"t2 can now find '###': {t2.Transform("Test ### Test")}")
End Sub
End Module
t2 can now find '###': Test MATCH Test Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t1 As New uCalc.Transformer() Dim t2 As New uCalc.Transformer() '// Define a custom token in the first transformer Dim customToken = t1.Tokens.Add("###", TokenType.Generic) '// Import the token definition into the second transformer t2.Tokens.Add(customToken) t2.FromTo("###", "MATCH") Console.WriteLine($"t2 can now find '###': {t2.Transform("Test ### Test")}") End Sub End Module