Skip to content

Commit

Permalink
add stringUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Mar 13, 2024
1 parent 5b2e6a4 commit 278e073
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/utils/StringUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package utils;

public class StringUtil {

// https://stackoverflow.com/questions/2255500/can-i-multiply-strings-in-java-to-repeat-sequence
private String multiplyStr(String s, int multiply){
StringBuilder r = new StringBuilder();
for (int i = 0; i < multiply; i++){
r.append(s);
}
return r.toString();
}

// public static void main(String[] args) {
// String res = multiplyStr("0", 3);
// System.out.println(res);
// }

}

0 comments on commit 278e073

Please sign in to comment.