fixed bug for issue #1336

This commit is contained in:
root 2022-10-04 12:21:32 -07:00 committed by Yong Wang
parent 119312091c
commit d8eef2e7f2

View File

@ -534,7 +534,13 @@ bool SubString::convertImpl(String & out,IParser::Pos & pos)
{
++pos;
auto length = getConvertedArgument(fn_name, pos);
out = "substr("+ source + ", " + startingIndex + " + 1, " + length + ")";
if(startingIndex.empty())
return false;
else if(startingIndex[0] == '-')
out = "substr("+ source + ", " + startingIndex + ", " + length + ")";
else
out = "substr("+ source + ", " + startingIndex + " + 1, " + length + ")";
}
else
out = "substr("+ source + "," + startingIndex + " + 1)";