ahc.util.string
Class StringHelper

java.lang.Object
  |
  +--ahc.util.string.StringHelper

public class StringHelper
extends java.lang.Object

This class is a collection of helper functions for string handling.

Author:
Arno Haase

Constructor Summary
StringHelper()
           
 
Method Summary
static java.lang.String escape(java.lang.String src)
          replaces special characters that affect formatting with non-formatting character sequences.
static java.lang.String prettyPrint(java.util.Date date)
          formats a date using the default locale settings.
static java.lang.String prettyPrint(long num)
          formats a number using the default locale settings.
static java.lang.String prettyPrint(java.lang.Number num)
          formats a number using the default locale settings.
static java.lang.String replace(java.lang.String src, java.lang.String search, java.lang.String replace)
          returns a new string in which one search string is replaced by another.
static java.lang.String truncate(java.lang.String str, int maxLen)
          truncates a string regardless of its length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringHelper

public StringHelper()
Method Detail

prettyPrint

public static java.lang.String prettyPrint(long num)
formats a number using the default locale settings.


prettyPrint

public static java.lang.String prettyPrint(java.lang.Number num)
formats a number using the default locale settings.


prettyPrint

public static java.lang.String prettyPrint(java.util.Date date)
formats a date using the default locale settings.


replace

public static java.lang.String replace(java.lang.String src,
                                       java.lang.String search,
                                       java.lang.String replace)
returns a new string in which one search string is replaced by another.


escape

public static java.lang.String escape(java.lang.String src)
replaces special characters that affect formatting with non-formatting character sequences.


truncate

public static java.lang.String truncate(java.lang.String str,
                                        int maxLen)
truncates a string regardless of its length. This method is a workaround for a shortcoming of String.substring (int, int) that is unable to handle the case where the number of characters would extend beyond the end of the string.