From 2ee43de10e5311ba64e7fc855e253d02326e254c Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Fri, 14 Mar 2014 20:44:13 +0200 Subject: [PATCH] API usability improvement --- src/main/java/eu/svjatoslav/commons/string/String2.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() { -- 2.20.1