API usability improvement
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 14 Mar 2014 18:44:13 +0000 (20:44 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 14 Mar 2014 18:44:13 +0000 (20:44 +0200)
src/main/java/eu/svjatoslav/commons/string/String2.java

index fe83ade..b19e99a 100755 (executable)
@@ -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() {