org.incava.lang

Class StringExt

public class StringExt extends Object

Extensions to the String class.
Field Summary
static booleanDEBUG
Set this to true for debugging output.
Method Summary
static Stringjoin(Collection c, String str)
static Stringleft(String str, int n)
Returns the leftmost n characters of the string, not exceeding the length of the string.
static Listlistify(String str)
Converts the (possibly quoted) string into a list, delimited by whitespace and commas..
static voidmain(String[] args)
static Stringpad(String str, char ch, int length)
Returns a string starting with the str parameter, with ch's following the string to a length of length.
static Stringpad(String str, int length)
static StringpadLeft(String str, char ch, int length)
Same as the pad method, but applies the padding to the left-hand (leading) side of the string.
static Stringrepeat(String str, int length)
static Stringrepeat(char ch, int length)
static Stringright(String str, int n)
Returns the rightmost n characters of the string, not exceeding the length of the string.
static String[]split(String str, char delim, int max)
Returns an array of strings split at the character delimiter.
static String[]split(String str, String delim, int max)
Returns an array of strings split at the string delimiter.
static String[]split(String str, char delim)
Returns an array of strings split at the character delimiter.
static String[]split(String str, String delim)
Returns an array of strings split at the string delimiter.
static voidtest(String str, char del)
static voidtest(String str, String del)
StringtoString(double n, int precision)

Field Detail

DEBUG

public static boolean DEBUG
Set this to true for debugging output.

Method Detail

join

public static String join(Collection c, String str)

left

public static String left(String str, int n)
Returns the leftmost n characters of the string, not exceeding the length of the string. Does not throw the annoying IndexOutOfBoundsException.

listify

public static List listify(String str)
Converts the (possibly quoted) string into a list, delimited by whitespace and commas..

main

public static void main(String[] args)

pad

public static String pad(String str, char ch, int length)
Returns a string starting with the str parameter, with ch's following the string to a length of length. Examples: pad("abcd", '*', 8) -> "abcd****" pad("abcd", '*', 3) -> "abcd"

pad

public static String pad(String str, int length)

padLeft

public static String padLeft(String str, char ch, int length)
Same as the pad method, but applies the padding to the left-hand (leading) side of the string. Examples:
     pad("420", '*', 8) -> "*****420"
     pad("1144", '*', 3) -> "1144"
 

repeat

public static String repeat(String str, int length)

repeat

public static String repeat(char ch, int length)

right

public static String right(String str, int n)
Returns the rightmost n characters of the string, not exceeding the length of the string. Does not throw the annoying IndexOutOfBoundsException.

split

public static String[] split(String str, char delim, int max)
Returns an array of strings split at the character delimiter.

split

public static String[] split(String str, String delim, int max)
Returns an array of strings split at the string delimiter.

split

public static String[] split(String str, char delim)
Returns an array of strings split at the character delimiter.

split

public static String[] split(String str, String delim)
Returns an array of strings split at the string delimiter.

test

public static void test(String str, char del)

test

public static void test(String str, String del)

toString

public String toString(double n, int precision)