View RSS Feed

Java String

All about Java String.

  1. equalsIgnoreCase method

    by , 04-26-2012 at 07:01 PM
    It shall be ignore in Java string comparison tests that whether strings are uppercase of lowercase. Use EqualsIgnoreCase mthods for equality so that to test the strings .
    Java Code:
    String string1 = "foo";
    String string2 = "FOO";
    
    // java string compare while ignoring case
    if (string1.equalsIgnoreCase(string2))
    {
      // this line WILL print
      System.out.println("Ignoring case, the two strings are the same.")
    ...
    Categories
    Compare