args.add(str);
args.add(source);
if (from != null)
{
// Add 1 to the passed in value so that it is of origin 1 to be compatible with CHARINDEX
args.add(new NumericExpression(from, ScalarExpression.OP_ADD, integerLiteral));
}
NumericExpression locateExpr = new NumericExpression("CHARINDEX", args);
// Subtract 1 from the result of CHARINDEX to be consistent with Java strings
// TODO Would be nice to put this in parentheses
return new NumericExpression(locateExpr, ScalarExpression.OP_SUB, integerLiteral);
}