Normalizing various boolean representations to a standard format.
ID: 795
See: Alternation
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Normalize 'true-like' and 'false-like' values
t.FromTo("{ True | Yes | On }", "TRUE");
t.FromTo("{ False | No | Off }", "FALSE");
Console.WriteLine(t.Transform("System is On and Power is False"));
Console.WriteLine(t.Transform("Access: Yes, Admin: No"));
System is TRUE and Power is FALSE
Access: TRUE, Admin: FALSE using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Normalize 'true-like' and 'false-like' values t.FromTo("{ True | Yes | On }", "TRUE"); t.FromTo("{ False | No | Off }", "FALSE"); Console.WriteLine(t.Transform("System is On and Power is False")); Console.WriteLine(t.Transform("Access: Yes, Admin: No"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Normalize 'true-like' and 'false-like' values
t.FromTo("{ True | Yes | On }", "TRUE");
t.FromTo("{ False | No | Off }", "FALSE");
cout << t.Transform("System is On and Power is False") << endl;
cout << t.Transform("Access: Yes, Admin: No") << endl;
}
System is TRUE and Power is FALSE
Access: TRUE, Admin: FALSE #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Normalize 'true-like' and 'false-like' values t.FromTo("{ True | Yes | On }", "TRUE"); t.FromTo("{ False | No | Off }", "FALSE"); cout << t.Transform("System is On and Power is False") << endl; cout << t.Transform("Access: Yes, Admin: No") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Normalize 'true-like' and 'false-like' values
t.FromTo("{ True | Yes | On }", "TRUE")
t.FromTo("{ False | No | Off }", "FALSE")
Console.WriteLine(t.Transform("System is On and Power is False"))
Console.WriteLine(t.Transform("Access: Yes, Admin: No"))
End Sub
End Module
System is TRUE and Power is FALSE
Access: TRUE, Admin: FALSE Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Normalize 'true-like' and 'false-like' values t.FromTo("{ True | Yes | On }", "TRUE") t.FromTo("{ False | No | Off }", "FALSE") Console.WriteLine(t.Transform("System is On and Power is False")) Console.WriteLine(t.Transform("Access: Yes, Admin: No")) End Sub End Module