sklose / NCalc2

expression evaluator for .NET with built-in compiler
MIT License
166 stars 58 forks source link

Add support of unicode characters in parameters #59

Closed nickger closed 6 months ago

nickger commented 3 years ago

Currently the string "Kälteleistung / 2" cannot be compiled, please, add support for unicode characters in parameters.

Bykiev commented 6 months ago

I've tried with the latest version and can't reproduce the issue with such code

var expr = new Expression("[Kälteleistung] / 2");
expr.Parameters["Kälteleistung"] = 10;
var res = expr.Evaluate();

I believe it's because you should use the square brackets with parameter name. Can be closed as not a bug

nickger commented 6 months ago

Should the brackets be inside or outside of the quotes?

Bykiev commented 6 months ago

I think there is no need for escaping parameter names with quotes, only the unicode strings. For ex:

https://github.com/sklose/NCalc2/blob/4e0338cbf84236087b793430aa91287270a1df05/test/NCalc.Tests/Fixtures.cs#L187-L190

nickger commented 6 months ago

Ok.