zzzzzzzs commented on code in PR #20342:
URL: https://github.com/apache/flink/pull/20342#discussion_r969203533
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java:
##########
@@ -371,6 +371,11 @@ public static String repeat(String str, int repeat) {
return EncodingUtils.repeat(str, repeat);
}
+ /** Returns an expr where all characters in from have been replaced with
those in to. */
+ public static String translate3(String str, String search, String
replacement) {
+ return org.apache.commons.lang3.StringUtils.replaceChars(str, search,
replacement);
Review Comment:
Replacechars () is a static method of the stringutils class, which is used
to replace all search characters with replacement characters. And replace() is
a static method of the stringutils class, which optionally accepts the first
maximum number of matches of the search string to be replaced in a given text.
Example:
```java
public static void main(String[] args) {
String s1 = StringUtils.replaceChars("AaaBabbCc", "ab", "123");
String s2 = StringUtils.replace("AaaBabbCc", "ab", "123");
System.out.println("replaceChars:" + s1);
System.out.println("replace:" + s2);
}
```
> replaceChars:A11B122Cc
replace:AaaB123bCc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]