diff --git a/include/expr.cpp b/include/expr.cpp index 78d2e1991..4fbc45322 100755 --- a/include/expr.cpp +++ b/include/expr.cpp @@ -837,13 +837,7 @@ bool TExpression::compile(const char* expression, TTypeexp type) else { const int n2 = atoi(s2); - // if (n1 == 0) sc << format(" right(%s,%d)", _tok, n2); - // else - // if (n2 == 0) sc << format(" left(%s,%d)", _tok, n1); - // else - if (n2 == 0) sc << format(" mid(%s,%d,0)", _tok, n1); - else - sc << format(" mid(%s,%d,%d)", _tok, n1, n2 - n1 + 1); + sc << format(" mid(%s,%d,%d)", _tok, n1, (n2 < n1) ? -1 : n2 - n1 + 1); } } }