added tools
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / string / String2.java
index fe83ade..45c6cd0 100755 (executable)
@@ -1,7 +1,7 @@
 /*
  * Svjatoslav Commons - shared library of common functionality.
  * Copyright ©2012-2014, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 3 of the GNU Lesser General Public License
  * or later as published by the Free Software Foundation.
@@ -36,8 +36,11 @@ public class String2 {
        }
 
        /**
-        * Cut given amount of characters from the left of the string. Return cutted
-        * part.
+        * Cut given amount of characters from the left of the string.
+        *
+        * @param cutAmount
+        *            of characters to cut
+        * @return cutted part.
         */
        public String cutLeft(final int cutAmount) {
 
@@ -53,7 +56,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 +64,8 @@ public class String2 {
                        for (int i = 0; i < charactersToAdd; i++)
                                chars.add(' ');
                }
+
+               return this;
        }
 
        public int getLength() {