From: Svjatoslav Agejenko Date: Fri, 14 Mar 2014 18:44:13 +0000 (+0200) Subject: API usability improvement X-Git-Tag: svjatoslavcommons-1.8~103 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=2ee43de10e5311ba64e7fc855e253d02326e254c;p=svjatoslav_commons.git API usability improvement --- diff --git a/src/main/java/eu/svjatoslav/commons/string/String2.java b/src/main/java/eu/svjatoslav/commons/string/String2.java index fe83ade..b19e99a 100755 --- a/src/main/java/eu/svjatoslav/commons/string/String2.java +++ b/src/main/java/eu/svjatoslav/commons/string/String2.java @@ -53,7 +53,7 @@ public class String2 { return result; } - public void enforceLength(final int targetLength) { + public String2 enforceLength(final int targetLength) { if (getLength() > targetLength) chars.subList(targetLength, getLength()).clear(); else if (getLength() < targetLength) { @@ -61,6 +61,8 @@ public class String2 { for (int i = 0; i < charactersToAdd; i++) chars.add(' '); } + + return this; } public int getLength() {