Converting from Celsius to Fahrenheit with the Transformer
ID: 174
See: {@Eval}, Syntax Definitions
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
// Define the pattern first
t.FromTo("Temperature: {temp} C", "temperature: {@Eval: Double(temp) * 1.8 + 32} F");
// Perform the Transform() operation
Console.WriteLine(t.Transform("Here is the temperature: 22.5 C"));
Here is the temperature: 72.5 F using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); // Define the pattern first t.FromTo("Temperature: {temp} C", "temperature: {@Eval: Double(temp) * 1.8 + 32} F"); // Perform the Transform() operation Console.WriteLine(t.Transform("Here is the temperature: 22.5 C"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
// Define the pattern first
t.FromTo("Temperature: {temp} C", "temperature: {@Eval: Double(temp) * 1.8 + 32} F");
// Perform the Transform() operation
cout << t.Transform("Here is the temperature: 22.5 C") << endl;
}
Here is the temperature: 72.5 F #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); // Define the pattern first t.FromTo("Temperature: {temp} C", "temperature: {@Eval: Double(temp) * 1.8 + 32} F"); // Perform the Transform() operation cout << t.Transform("Here is the temperature: 22.5 C") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
'// Define the pattern first
t.FromTo("Temperature: {temp} C", "temperature: {@Eval: Double(temp) * 1.8 + 32} F")
'// Perform the Transform() operation
Console.WriteLine(t.Transform("Here is the temperature: 22.5 C"))
End Sub
End Module
Here is the temperature: 72.5 F Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() '// Define the pattern first t.FromTo("Temperature: {temp} C", "temperature: {@Eval: Double(temp) * 1.8 + 32} F") '// Perform the Transform() operation Console.WriteLine(t.Transform("Here is the temperature: 22.5 C")) End Sub End Module