I am using NCalc in my project to evaluate expressions. The framework includes a set of already implemented functions which can be found here.
I am interested in calculating the length of a number or a string. Can I achieve that using just the built-in functions?
For getting length of an integer number, you can do something like this-
int length = ceiling(log10(number));
But a method like this will be much efficient-
int countLength(int number){
if(number>9) return countLength(number/10) + 1;
return 1;
}