List of utility methods to do String Repeat
String | repeat(String str, int repeat) repeat StringBuilder buffer = new StringBuilder(repeat * str.length()); for (int i = 0; i < repeat; i++) { buffer.append(str); return buffer.toString(); |
String | repeat(String str, int repeat) Repeat a String StringBuffer buffer = new StringBuffer(repeat * str.length()); for (int i = 0; i < repeat; i++) { buffer.append(str); return buffer.toString(); |
String | repeat(String string, int n) Like a monkey with a miniature symbol. StringBuilder sb = new StringBuilder(string.length() * n); for (int i = 0; i < n; i++) { sb.append(string); return sb.toString(); |
String | repeat(String string, int number) repeat final StringBuilder builder = new StringBuilder(); repeat(string, number, builder); return builder.toString(); |
String | repeat(String string, int times) repeat StringBuilder buf = new StringBuilder(string.length() * times); for (int i = 0; i < times; i++) { buf.append(string); return buf.toString(); |
String | repeat(String string, int times) Returns a string that is formed by the repetition of a provided string a given number of times. if (times < 0) throw new IllegalArgumentException("Argument 'times' cannot be less than 0"); if (string == null) throw new IllegalArgumentException("Argument 'string' cannot be null"); if (times == 1) return string; if (times == 0 || string.length() == 0) return ""; ... |
String | repeat(String val, int n) Return n repetitions of a string, which is usually a single character. StringBuffer sb = new StringBuffer(); for (int i = 0; i < n; i++) { sb.append(val); return sb.toString(); |
List | repeat(String value, int times) Repeats a String literal N times. List<String> outList = new ArrayList<String>(times); for (int i = 0; i < times; i++) { outList.add(value); return outList; |
String | repeatChar(String c, int repeatCount) Creates a string with the specified length. char[] chArray = new char[repeatCount]; Arrays.fill(chArray, c.charAt(0)); return String.valueOf(chArray); |
String | repeatImplodeString(String string, int length, String seperator) repeat Implode String if (length == 0) { return ""; } else { String[] strings = new String[length]; Arrays.fill(strings, string); return implodeString(strings, seperator); |