+ private final List<Character> chars = new ArrayList<>();
+
+ public String2(String value) {
+ addSuffix(value);
+ }
+
+ public String2 addPrefix(final String prefix) {
+ if (prefix == null)
+ return this;
+
+ int i = 0;
+ for (final char c : prefix.toCharArray())
+ chars.add(i++, c);
+
+ return this;
+ }
+
+ public String2 addSuffix(final String suffix) {
+ if (suffix == null)
+ return this;
+
+ for (final char c : suffix.toCharArray())
+ chars.add(c);
+
+ return this;
+ }
+
+ public String2 addSuffix(String separator, final String suffix) {
+ if (!isEmpty())
+ addSuffix(separator);
+
+ addSuffix(suffix);
+
+ return this;
+ }
+
+ /**
+ * Cut given amount of characters from the left of the string.
+ *
+ * @param cutAmount of characters to cut
+ * @return part that was cut.
+ */
+ public String2 trimPrefix(final int cutAmount) {
+
+ int actualCutAmount = cutAmount;
+
+ if (actualCutAmount > getLength())
+ actualCutAmount = getLength();
+
+ chars.subList(0, actualCutAmount).clear();
+
+ return this;
+ }
+
+ public String2 trimPrefixIfExists(String prefix) {
+ if (prefix == null)
+ return this;
+
+ if (hasPrefix(prefix))
+ trimPrefix(prefix.length());
+
+ return this;
+ }