Name: bsT130419 Date: 10/01/2001
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
It would be useful to have the methods:
append(String s, int count);
append(char c, int count);
insert(int offset, String s, int count);
insert(int offset, char c, int count);
in the StringBuffer class. These would repeat the append/insert
procedure "count" times. Thus for a StringBuffer:
"72BCD9".append('0', 3) becomes "72BCD9000"
"72BCD9".insert(0, '0', 3) becomes "00072BCD9"
"blah".insert(2, '\t', 4) becomes "bl\t\t\t\tah"
These methods would be useful for inserting leading and trailing padding
into strings, etc.
(Review ID: 132887)
======================================================================
- relates to
-
JDK-8197594 String#repeat
-
- Resolved
-