Monday, 28 March 2016

Java Tutorial : Java String [compareToIgnoreCase(String str) method]


Click here to watch in Youtube :
https://www.youtube.com/watch?v=8qpt3KNL3Og&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java String [compareToIgnoreCase(String str) method] 
CompareToIgnoreCaseDemo.java
/*
 * public int compareToIgnoreCase(String str)
 * 
 * Parameters: 
 * ---------- 
 * str - the String to be compared.
 * 
 * Returns: 
 * ------- 
 * Returns an integer indicating whether this string
 * is greater than (result is > 0), equal to (result
 * is = 0), or less than (result is < 0) the
 * argument.
 */

public class CompareToIgnoreCaseDemo
{
    public static void main(String[] args)
    {

        int result = "welcome".compareTo("WELCOME");
        System.out.println("\"welcome\".compareTo(\"WELCOME\") = "
                + result);

        result = "welcome".compareToIgnoreCase("WELCOME");
        System.out
                .println("\"welcome\".compareToIgnoreCase(\"WELCOME\") = "
                        + result);
    }
}
Output
"welcome".compareTo("WELCOME") = 32
"welcome".compareToIgnoreCase("WELCOME") = 0
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_compareToIgnoreCase_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_compareToIgnoreCase_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f763f2167329fa6e35d47d9d3a5195613480d629/BasicJava/StringDemo_compareToIgnoreCase_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment