Commits

ltor...@81dbac14-341a-0410-aa85-cbcd92e6f43e  committed 5ea9127

New method hasLength(String) added
Obtained from: Lars Torunski

  • Participants
  • Parent commits aa87a41

Comments (0)

Files changed (1)

File src/java/com/opensymphony/oscache/util/StringUtil.java

  * @author <a href="&#109;a&#105;&#108;&#116;&#111;:chris&#64;swebtec.&#99;&#111;&#109;">Chris Miller</a>
  */
 public class StringUtil {
+	
     /**
      * Splits a string into substrings based on the supplied delimiter
      * character. Each extracted substring will be trimmed of leading
      * @param delimiter The character that delimits the string
      * @return A string array containing the resultant substrings
      */
-    public static List split(String str, char delimiter) {
+    public static final List split(String str, char delimiter) {
         // return no groups if we have an empty string
         if ((str == null) || "".equals(str)) {
             return new ArrayList();
 
         return parts;
     }
+    
+    /**
+     * @param s the string to be checked
+     * @return true if the string parameter contains at least one element 
+     */
+    public static final boolean hasLength(String s) {
+    	return (s != null) && (s.length() > 0);
+    }
+    
 }