net.sf.zekr.common.util
Class StringUtils

java.lang.Object
  extended by net.sf.zekr.common.util.StringUtils

public class StringUtils
extends java.lang.Object

Author:
Mohsen Saboorian

Nested Class Summary
static class StringUtils.Region
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String abbreviate(java.lang.String str, int size)
          Similar to StringUtils.abbreviate(String, int) method but adds no ellipsis to the end of the abbreviated string.
static StringUtils.Region getNthRegion(java.lang.String src, int n, char delim)
           
static java.lang.String getNthWord(java.lang.String src, int n, char delim)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

getNthRegion

public static StringUtils.Region getNthRegion(java.lang.String src,
                                              int n,
                                              char delim)

getNthWord

public static java.lang.String getNthWord(java.lang.String src,
                                          int n,
                                          char delim)

main

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

abbreviate

public static java.lang.String abbreviate(java.lang.String str,
                                          int size)
Similar to StringUtils.abbreviate(String, int) method but adds no ellipsis to the end of the abbreviated string. This method also abbreviates to the nearest space character (\x20), so that the result string size is smaller or equal to size parameter.
This method returns an empty string if no space character found within the given size range.

Parameters:
str - string to be abbreviated
size - boundary to which the result size of abbreviated string is less or equal
Returns:
abbreviated string