ExpressionEval Configure evaluator

1. Description

It’s possible to configure several behavior in the component: the language, the decimal separator and the string tags.

2. Configure the language

By default, the component works in english. This concerns keywords: logical operators : and, or, xor and not and boolean values: true/false.

There are two languages available in the component: English and French. You can set the language to French:

ExpressionEval evaluator = new ExpressionEval();
evaluator.SetLang(Language.Fr);

So now in french, the keywords in expressions have to be used in French:

English    French
---------------
And    ->  Et
Or     ->  Ou
Xor    ->  Oux
Not    ->  Non
True   ->  Vrai
False  ->  Faux

Examples of expression in French:

(a et b), (a=vrai), …

As a reminder, keywords are case insensitive.

3. Configure the decimal separator

By default in the component, the double decimal separator is the dot character and the function call parameter separtor is the comma. This is the standard configuration. These both separators are linked.

Examples of the standard decimal separator configuration:

A double number: 12.45 
A function with two parameters: fct(a,b)

It’s possible to change this default standard configuration to have an “Excel like” behavior. The double decimal separator is the dot and the function call parameter is the semicolon.

Examples of the Excel like configuration:

A double number: 12,45 
A function with two parameters: fct(a;b)

How to change the configuration to be “Excel like”:

evaluator.SetDecimalAndFunctionSeparators(DecimalAndFunctionSeparators.ExcelLike);

4. Configure the string tags

By default in the component, string tags, start and end is the double quotes: “

Examples: “hello”, “a”.

You can change this to have simple quote: ‘

Examples : ‘hello’, ‘a’.

How to change this configuration:

evaluator.SetStringTagCode(StringTagCode.Quote);