From: Svjatoslav Agejenko Date: Mon, 8 Jun 2020 18:04:35 +0000 (+0300) Subject: Possibility to repeat string. X-Git-Tag: svjatoslavcommons-1.8~14 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=49c08724984dbcc1bb45fc0c8a4cf3bf7b627178;p=svjatoslav_commons.git Possibility to repeat string. --- diff --git a/src/main/java/eu/svjatoslav/commons/string/String2.java b/src/main/java/eu/svjatoslav/commons/string/String2.java index 04e6489..6b36b5b 100755 --- a/src/main/java/eu/svjatoslav/commons/string/String2.java +++ b/src/main/java/eu/svjatoslav/commons/string/String2.java @@ -15,6 +15,15 @@ public class String2 { addSuffix(value); } + public String2 repeat(int count){ + String value = toString(); + + for (int i = 1; i < count; i++) { + addSuffix(value); + } + return this; + } + public String2 addPrefix(final String prefix) { if (prefix == null) return this;