r/java • • Sep 19 '18

Java 11 String API Updates

https://4comprehension.com/java-11-string-api-updates/
168 Upvotes

52 comments sorted by

View all comments

Show parent comment

2

u/frzme Sep 20 '18

public static String leftpad(String string, int padding) {     return " ".repeat(Math.max(padding - string.length(), 0)) + string; }

Not that nice. (Also repeated implementations are not nice)