Share on Google+Share on Google+

String toLowerCase and toUppercase methods example

String class provides methods toUpperCase() and toLowerCase().

String toUpperCase() and toLowerCase() methods example:-

String class provides methods toUpperCase() and toLowerCase(). Method toUpperCase() convert alphabetical characters in the string to uppercase and method toLowerCase() convert alphabetical characters in the string to  lowercase. We have used these two methods in this example. user can see how to use these methods.


<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx=""


xmlns:mx="library://" creationComplete="init();">



private function init():void{

var str1:String = "Rose India";

// for upper case

textcontrol1.text = str1.toUpperCase();

// for lower case

textcontrol2.text = str1.toLowerCase();




<s:Panel width="250" height="200" title="String Upper and Lower case example" backgroundColor="0xEEFFEE">


<mx:Text id="textmsg1" text="Upper Case" fontSize="12" fontWeight="bold"/>

<mx:Text id="textcontrol1"/>

<mx:Text id="textmsg2" text="Lower Case" fontSize="12" fontWeight="bold"/>

<mx:Text id="textcontrol2"/>




In this example, we have created a string type variable and initialize a string as "Rose India" and apply both toLowerCase() and toUpperCase() methods on them.


Download this code



Posted on: June 4, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null