org.znerd.util.text
Class TextUtils

java.lang.Object
  extended by org.znerd.util.text.TextUtils

public class TextUtils
extends Object

Text string utility functions.


Method Summary
static boolean isEmpty(String s)
          Checks if the specified string is either null or empty or contains only whitespace.
static boolean matches(String s, String regex)
          Checks if the specified string matches the specified regular expression.
static String quote(Object o)
          Puts quote characters around the string representation of an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

quote

public static final String quote(Object o)
Puts quote characters around the string representation of an object. Returns "(null)" if the object is null.


isEmpty

public static final boolean isEmpty(String s)
Checks if the specified string is either null or empty or contains only whitespace.


matches

public static final boolean matches(String s,
                                    String regex)
Checks if the specified string matches the specified regular expression.

This method differs from String.matches(String) in that this method also supports partial matches. To give an example:

 "bla bla".match("bla$"); // returns false
 TextUtils.matches("bla bla", "bla$"); // returns true
 



Copyright © 2011-2012. All Rights Reserved.