Using FormatStyle.Default and FormatStyle.None when a global uCalc.Format() rule is active.

ID: 1476

				
					using uCalcSoftware;

var uc = new uCalc();
// Define a global format rule for Double values
uc.Format("Def: Result = Format('${:.2f}', double(Result))", uc.DataTypeOf("Double"));

// FormatStyle.Default (or omitting the argument) applies the global rule
Console.WriteLine(uc.EvalStr("50 * 1.25", FormatStyle.Default));

// FormatStyle.None bypasses the global rule and returns the raw value
Console.WriteLine(uc.EvalStr("50 * 1.25", FormatStyle.None));
				
			
$62.50
62.5
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Define a global format rule for Double values
   uc.Format("Def: Result = Format('${:.2f}', double(Result))", uc.DataTypeOf("Double"));

   // FormatStyle.Default (or omitting the argument) applies the global rule
   cout << uc.EvalStr("50 * 1.25", FormatStyle::Default) << endl;

   // FormatStyle.None bypasses the global rule and returns the raw value
   cout << uc.EvalStr("50 * 1.25", FormatStyle::None) << endl;
}
				
			
$62.50
62.5
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Define a global format rule for Double values
      uc.Format("Def: Result = Format('${:.2f}', double(Result))", uc.DataTypeOf("Double"))
      
      '// FormatStyle.Default (or omitting the argument) applies the global rule
      Console.WriteLine(uc.EvalStr("50 * 1.25", FormatStyle.Default))
      
      '// FormatStyle.None bypasses the global rule and returns the raw value
      Console.WriteLine(uc.EvalStr("50 * 1.25", FormatStyle.None))
   End Sub
End Module
				
			
$62.50
62.5