org.incava.lang
Class StringExt

java.lang.Object
  extended by org.incava.lang.StringExt

public class StringExt
extends java.lang.Object

Extensions to the String class.


Field Summary
static boolean DEBUG
          Set this to true for debugging output.
 
Constructor Summary
StringExt()
           
 
Method Summary
static java.lang.String join(java.util.Collection c, java.lang.String str)
           
static java.lang.String left(java.lang.String str, int n)
          Returns the leftmost n characters of the string, not exceeding the length of the string.
static java.util.List listify(java.lang.String str)
          Converts the (possibly quoted) string into a list, delimited by whitespace and commas..
static void main(java.lang.String[] args)
           
static java.lang.String pad(java.lang.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 java.lang.String pad(java.lang.String str, int length)
           
static java.lang.String padLeft(java.lang.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 java.lang.String repeat(char ch, int length)
           
static java.lang.String repeat(java.lang.String str, int length)
           
static java.lang.String right(java.lang.String str, int n)
          Returns the rightmost n characters of the string, not exceeding the length of the string.
static java.lang.String[] split(java.lang.String str, char delim)
          Returns an array of strings split at the character delimiter.
static java.lang.String[] split(java.lang.String str, char delim, int max)
          Returns an array of strings split at the character delimiter.
static java.lang.String[] split(java.lang.String str, java.lang.String delim)
          Returns an array of strings split at the string delimiter.
static java.lang.String[] split(java.lang.String str, java.lang.String delim, int max)
          Returns an array of strings split at the string delimiter.
static void test(java.lang.String str, char del)
           
static void test(java.lang.String str, java.lang.String del)
           
 java.lang.String toString(double n, int precision)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

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

Constructor Detail

StringExt

public StringExt()
Method Detail

split

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


split

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


split

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


split

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


listify

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


pad

public static java.lang.String pad(java.lang.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"


padLeft

public static java.lang.String padLeft(java.lang.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"
 


pad

public static java.lang.String pad(java.lang.String str,
                                   int length)

repeat

public static java.lang.String repeat(java.lang.String str,
                                      int length)

repeat

public static java.lang.String repeat(char ch,
                                      int length)

toString

public java.lang.String toString(double n,
                                 int precision)

left

public static java.lang.String left(java.lang.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.


right

public static java.lang.String right(java.lang.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.


join

public static java.lang.String join(java.util.Collection c,
                                    java.lang.String str)

test

public static void test(java.lang.String str,
                        char del)

test

public static void test(java.lang.String str,
                        java.lang.String del)

main

public static void main(java.lang.String[] args)