#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // This examples shows the default match by // token mode, as well as how to reconfigure // it in order to do match by character // along with a whitespace variation auto t = uc.NewTransformer(); auto txt = "This is an island test, I said."; t.FromTo("is", ""); cout << t.Transform(txt) << endl; cout << "" << endl; t.Tokens().Description("Match by character"); t.Tokens().Add("."); // This overrides existing tokens t.FromTo("is", ""); cout << t.Tokens().Description() << endl; cout << t.Transform(txt) << endl; cout << "" << endl; // Note: whitespace sensitivity is off by default // Whitespace token is re-introduced // (after being overridden in the previous Token Add()) t.Tokens().Description("By char + whitespace ignored"); t.Tokens().Add("[\\t\\v ]+", TokenType::Whitespace); t.FromTo("is", "<{@Self}>"); cout << t.Tokens().Description() << endl; cout << t.Transform(txt) << endl; }