API usability improvement
[svjatoslav_commons.git] / 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() {