From 49c08724984dbcc1bb45fc0c8a4cf3bf7b627178 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Mon, 8 Jun 2020 21:04:35 +0300 Subject: [PATCH] Possibility to repeat string. --- src/main/java/eu/svjatoslav/commons/string/String2.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- 2.20.1