This documentation is provisional, and should be replaced by Javadoc.
java.lang.String concatenation in Java is slow and bad practice, due to String immutability. Don't get me wrong: I dig immutability, but it's not for all tasks.
java.lang.StringBuilder looks too low-level and, for some tasks, too verbose -- like almost everything Java.
This package contains a wrapper for StringBuilder as easy, or easier, to use than String concatenation, with some batteries.
public EasyString(String string)Creates a EasyString from a String.
public EasyString(StringBuilder builder)Creates a EasyString from a StringBuilder.
public EasyString(Object... args)Creates a EasyString from Object[] or Object varargs.
public EasyString append(Object... args)Appends Object[] or Object varargs to an EasyString instance. Returns this, so can be chained.
Not recommended for appending constant values; use EasyString() instead.
public static EasyString concat(String separator, Object... args)Inspired by Lua's table.concat(). Interpolates each elements of args (Object[] or Object varargs) with separator.
Not recommended for "" separator; use EasyString() instead.
public static void print(Object... args)Wrapper for System.out.print(new EasyString(Object... args)).
public static void println(Object... args)Wrapper for System.out.println(new EasyString(Object... args)).
public static EasyString repeat(String string, int times)Repeats string times times. For example, repeat("*", 5) returns *****.
public char charArt(int index)Returns the index-th char from CharSequence built.
public int length()Returns the length of CharSequence built.
public CharSequence subSequence(int start, int end)Returns the subsquence [start,end - 1] from CharSequence built.
public String toString()Returns String built.
- Tests
- More tests
- File writing, similarly to
print()andprintln() - StringBuffer wrapper
- Implementing useful interfaces
- CharSequence
- Javadoc
- Benchmark against other alternatives