Thursday, 10 March 2016

Java Tutorial : Java String (toLowerCase and toUpperCase methods)


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

ToLowerCaseDemo.java

/*
 * public String toLowerCase()
 * 
 * Returns: 
 * ------- 
 * the String, converted to lowercase.
 * 
 * ============================================
 * 
 * public String toLowerCase(Locale locale)
 * 
 * Parameters: 
 * ---------- 
 * locale - use the case transformation rules for
 * this locale.
 * 
 * Returns: 
 * ------- 
 * the String, converted to lowercase.
 */

import java.util.Locale;

public class ToLowerCaseDemo
{

    public static void main(String[] args)
    {
        String str1 = "WELCOME";
        String strLower1 = str1.toLowerCase();
        System.out.println("strLower1 = " + strLower1);

        String str2 = "HELLO";
        String strLower2 = str2.toLowerCase(Locale.CANADA);
        System.out.println("strLower2 = " + strLower2);

    }

}
Output
strLower1 = welcome
strLower2 = hello
ToUpperCaseDemo.java
/*
 * public String toUpperCase()
 *  * 
 * Returns: 
 * ------- * 
 * the String, converted to uppercase.
 * 
 * ===========================================
 * 
 * public String toUpperCase(Locale locale)
 *  
 * Parameters: 
 * ---------- 
 * locale - use the case transformation rules for
 * this locale.
 * 
 * Returns: 
 * ------- 
 * the String, converted to uppercase.
 */
import java.util.Locale;

public class ToUpperCaseDemo
{

    public static void main(String[] args)
    {
        String str1 = "welcome";
        String strUpper1 = str1.toUpperCase();
        System.out.println("strUpper1 = " + strUpper1);

        String str2 = "hello";
        String strUpper2 = str2.toUpperCase(Locale.ITALIAN);
        System.out.println("strUpper2 = " + strUpper2);
    }
}
Output
strUpper1 = WELCOME
strUpper2 = HELLO
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_toLower_Upper_App.zip?attredirects=0&d=1

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/a73203f981da1e65b72e10bb91ed595b4f0c377b/BasicJava/StringDemo_toLower_Upper_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