com.generationjava.lang
Class StringW

java.lang.Object
  extended bycom.generationjava.lang.StringW

public final class StringW
extends Object

A set of String library static methods. While extending String or StringBuffer would have been the nicest solution, that is not possible, so a simple set of static methods seems the most workable. Most methods have now gone to Commons Lang StringUtils.


Constructor Summary
StringW()
           
 
Method Summary
static String join(Object[] objs, String sep, String pre, String post)
           
static String wordWrap(String str)
          Create a word-wrapped version of a String.
static String wordWrap(String str, int width)
          Create a word-wrapped version of a String.
static String wordWrap(String str, int width, String delim, String split)
          Word-wrap a string.
static String wordWrap(String str, String width, String delim, String split)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringW

public StringW()
Method Detail

join

public static String join(Object[] objs,
                          String sep,
                          String pre,
                          String post)

wordWrap

public static String wordWrap(String str)
Create a word-wrapped version of a String. Wrap at 80 characters and use newlines as the delimiter. If a word is over 80 characters long use a - sign to split it.


wordWrap

public static String wordWrap(String str,
                              int width)
Create a word-wrapped version of a String. Wrap at a specified width and use newlines as the delimiter. If a word is over the width in lenght use a - sign to split it.


wordWrap

public static String wordWrap(String str,
                              String width,
                              String delim,
                              String split)

wordWrap

public static String wordWrap(String str,
                              int width,
                              String delim,
                              String split)
Word-wrap a string.

Parameters:
str - String to word-wrap
width - int to wrap at
delim - String to use to separate lines
split - String to use to split a word greater than width long
Returns:
String that has been word wrapped


Copyright © 2000-2005 OSJava. All Rights Reserved.