Fixed #23. Added support for repeat function

This commit is contained in:
Shekhar Gulati
2016-05-21 19:54:21 +05:30
parent 8ee53f4121
commit 0954158be4
2 changed files with 21 additions and 0 deletions
+12
View File
@@ -744,6 +744,18 @@ public abstract class Strman {
return value.replaceAll("\\s", "");
}
/**
* Returns a repeated string given a multiplier.
*
* @param value The input String
* @param multiplier Number of repeats
* @return The String repeated
*/
public static String repeat(final String value, final int multiplier) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Stream.generate(() -> value).limit(multiplier).collect(joining());
}
public static String decode(final String value, final int digits, final int radix) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays