Possibility to repeat string.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 8 Jun 2020 18:04:35 +0000 (21:04 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 8 Jun 2020 18:04:35 +0000 (21:04 +0300)
src/main/java/eu/svjatoslav/commons/string/String2.java

index 04e6489..6b36b5b 100755 (executable)
@@ -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;