empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1299673 - /empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
Date Mon, 12 Mar 2012 13:37:13 GMT
Author: doebele
Date: Mon Mar 12 13:37:12 2012
New Revision: 1299673

URL: http://svn.apache.org/viewvc?rev=1299673&view=rev
Log:
EMPIREDB-126
tiny improvement to StringUtils

Modified:
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java?rev=1299673&r1=1299672&r2=1299673&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java Mon
Mar 12 13:37:12 2012
@@ -195,6 +195,21 @@ public class StringUtils
     }
     
     /**
+     * Compares two Strings with each other - either with or without character case. Both
arguments may be null.
+     * @param s1 the first String
+     * @param s2 the second String
+     * @param ignoreCase whether to ignore the character casing or not
+     * @return true if the two strings supplied are equal 
+     */
+    public static boolean compareEqual(String s1, String s2, boolean ignoreCase)
+    {
+        if (s1==null || s2==null)
+            return (s1==s2);
+        // Compare 
+        return (ignoreCase) ? s1.equalsIgnoreCase(s2) : s1.equals(s2);
+    }
+    
+    /**
      * Validates a given string. If the string is empty then null is returned. 
      * Otherwise the trimmed string is returned.
      * 



Mime
View raw message