This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 0712b3ac9c StringUtils improvements
0712b3ac9c is described below

commit 0712b3ac9cb1113d89919c2ad31c3f2b75d1dff0
Author: James Bognar <[email protected]>
AuthorDate: Sun Nov 30 11:10:41 2025 -0500

    StringUtils improvements
---
 .../apache/juneau/common/utils/StringUtils.java    |  2 +-
 .../java/org/apache/juneau/common/utils/Utils.java | 23 +++++++++++++++++-----
 .../juneau/common/utils/StringUtils_Test.java      |  1 -
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
index c648a5559a..2b4cf29fdc 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
@@ -6796,7 +6796,7 @@ public class StringUtils {
         * @param b Object 2.
         * @return <jk>true</jk> if both objects are equal ignoring case.
         */
-       public static boolean eqic(Object a, Object b) {
+       public static boolean equalsIgnoreCase(Object a, Object b) {
                if (a == null && b == null)
                        return true;
                if (a == null || b == null)
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/Utils.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/Utils.java
index 9fa7ecc373..fd53892cae 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/Utils.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/Utils.java
@@ -250,6 +250,9 @@ public class Utils {
        }
 
        /**
+        * Convenience method for calling {@link 
StringUtils#equalsIgnoreCase(String, String)}.
+        *
+        * <p>
         * Tests two strings for case-insensitive equality, but gracefully 
handles nulls.
         *
         * @param s1 String 1.
@@ -257,11 +260,21 @@ public class Utils {
         * @return <jk>true</jk> if the strings are equal.
         */
        public static boolean eqic(String s1, String s2) {
-               if (s1 == null)
-                       return s2 == null;
-               if (s2 == null)
-                       return false;
-               return s1.equalsIgnoreCase(s2);
+               return StringUtils.equalsIgnoreCase(s1, s2);
+       }
+
+       /**
+        * Convenience method for calling {@link 
StringUtils#equalsIgnoreCase(Object, Object)}.
+        *
+        * <p>
+        * Tests two objects for case-insensitive string equality by converting 
them to strings.
+        *
+        * @param o1 Object 1.
+        * @param o2 Object 2.
+        * @return <jk>true</jk> if both objects are equal ignoring case.
+        */
+       public static boolean eqic(Object o1, Object o2) {
+               return StringUtils.equalsIgnoreCase(o1, o2);
        }
 
        /**
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/common/utils/StringUtils_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/common/utils/StringUtils_Test.java
index d5c4f5ae96..11c4000bdb 100755
--- 
a/juneau-utest/src/test/java/org/apache/juneau/common/utils/StringUtils_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/common/utils/StringUtils_Test.java
@@ -21,7 +21,6 @@ import static 
org.apache.juneau.common.utils.CollectionUtils.*;
 import static org.apache.juneau.common.utils.StringUtils.*;
 import static org.apache.juneau.common.utils.StringUtils.compare;
 import static org.apache.juneau.common.utils.StringUtils.containsAny;
-import static org.apache.juneau.common.utils.StringUtils.eqic;
 import static org.apache.juneau.common.utils.StringUtils.reverse;
 import static org.apache.juneau.common.utils.Utils.eqic;
 import static org.apache.juneau.junit.bct.BctAssertions.*;

Reply via email to