Android Utililty Methods Char Repeat

List of utility methods to do Char Repeat

Description

The list of methods to do Char Repeat are organized into topic(s).

Method

Stringrepeat(char ch, int repeat)

Returns padding using the specified delimiter repeated to a given length.

 StringUtils.repeat(0, 'e')  = "" StringUtils.repeat(3, 'e')  = "eee" StringUtils.repeat(-2, 'e') = "" 

Note: this method doesn't not support padding with Unicode Supplementary Characters as they require a pair of char s to be represented.

char[] buf = new char[repeat];
for (int i = repeat - 1; i >= 0; i--) {
    buf[i] = ch;
return new String(buf);
StringrepeatingChars(char toRepeat, int number)
repeating Chars
char[] chars = new char[number];
Arrays.fill(chars, toRepeat);
return new String(chars);