Skip to content

Commit

Permalink
Add more PR review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Margarit Hakobyan <[email protected]>
  • Loading branch information
margarit-h committed Dec 6, 2022
1 parent f4ee6d0 commit 17bd91d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ private DefaultFunctionResolver locate() {
*/
private DefaultFunctionResolver position() {
return define(BuiltinFunctionName.POSITION.getName(),
impl(nullMissingHandling(TextFunction::exprPosition), INTEGER, STRING, STRING));
impl(nullMissingHandling(
(SerializableBiFunction<ExprValue, ExprValue, ExprValue>)
TextFunction::exprLocate), INTEGER, STRING, STRING));
}

/**
Expand Down Expand Up @@ -326,10 +328,6 @@ private static ExprValue exprLocate(ExprValue subStr, ExprValue str, ExprValue p
str.stringValue().indexOf(subStr.stringValue(), pos.integerValue() - 1) + 1);
}

private static ExprValue exprPosition(ExprValue subStr, ExprValue str) {
return exprLocate(subStr, str);
}

private static ExprValue exprReplace(ExprValue str, ExprValue from, ExprValue to) {
return new ExprStringValue(str.stringValue().replaceAll(from.stringValue(), to.stringValue()));
}
Expand Down

0 comments on commit 17bd91d

Please sign in to comment.