Handling an optional trailing semicolon.
ID: 239
See: Optional parts
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("Statement: {val} [;]", "Found: {val}");
Console.WriteLine(t.Transform("Statement: x = 1;")); // Output: Found: x = 1
Console.WriteLine(t.Transform("Statement: y = 2")); // Output: Found: y = 2
Found: x = 1
Found: y = 2 using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("Statement: {val} [;]", "Found: {val}"); Console.WriteLine(t.Transform("Statement: x = 1;")); // Output: Found: x = 1 Console.WriteLine(t.Transform("Statement: y = 2")); // Output: Found: y = 2
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("Statement: {val} [;]", "Found: {val}");
cout << t.Transform("Statement: x = 1;") << endl; // Output: Found: x = 1
cout << t.Transform("Statement: y = 2") << endl; // Output: Found: y = 2
}
Found: x = 1
Found: y = 2 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("Statement: {val} [;]", "Found: {val}"); cout << t.Transform("Statement: x = 1;") << endl; // Output: Found: x = 1 cout << t.Transform("Statement: y = 2") << endl; // Output: Found: y = 2 }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("Statement: {val} [;]", "Found: {val}")
Console.WriteLine(t.Transform("Statement: x = 1;")) '// Output: Found: x = 1
Console.WriteLine(t.Transform("Statement: y = 2")) '// Output: Found: y = 2
End Sub
End Module
Found: x = 1
Found: y = 2 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("Statement: {val} [;]", "Found: {val}") Console.WriteLine(t.Transform("Statement: x = 1;")) '// Output: Found: x = 1 Console.WriteLine(t.Transform("Statement: y = 2")) '// Output: Found: y = 2 End Sub End Module