XenoAmess commented on a change in pull request #577:
URL: https://github.com/apache/commons-lang/pull/577#discussion_r452279363



##########
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##########
@@ -6234,8 +6239,34 @@ public static String repeat(final char ch, final int 
repeat) {
         return new String(buf);
     }
 
-    // Padding
-    //-----------------------------------------------------------------------
+    /**
+     * <p>Returns padding using the specified delimiter repeated
+     * to a given length.</p>
+     *
+     * <pre>
+     * StringUtils.repeat('e', 0)  = ""
+     * StringUtils.repeat('e', 3)  = "eee"
+     * StringUtils.repeat('e', -2) = ""
+     * </pre>
+     *
+     * <p>Note: this method does not support padding with
+     * <a 
href="http://www.unicode.org/glossary/#supplementary_character";>Unicode 
Supplementary Characters</a>
+     * as they require a pair of {@code char}s to be represented.
+     * If you are needing to support full I18N of your applications
+     * consider using {@link #repeat(String, int)} instead.
+     * </p>
+     *
+     * @param stringBuilder  stringBuilder to fill
+     * @param ch  character to repeat
+     * @param repeat  number of times to repeat char, negative treated as zero
+     * @see #repeat(String, int)
+     */
+    public static void repeat(StringBuilder stringBuilder, final char ch, 
final int repeat) {

Review comment:
       > Why is this API typed to a `StringBuilder` instead of a `Appendable`?
   
   @garydgregory Oh I guess I found out why I didn;t use Appendable when create 
this function...
   Appendable.append can throw IOException, and we must catch it.
   That might cause performance issue, so I just used StringBuilder instead.
   
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to