Share on Google+Share on Google+

String Class in Action Script3

Advertisement
String class is a data type. String class provides methods for access and manipulation of textual value.

String Class in Action Script3:-

String class is a data type. String class provides methods for access and manipulation of textual value.   In this example we have created different types of String class objects. String class have different types of constructors.

Example:-

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

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init();">

<fx:Script>

<![CDATA[

private function init():void{

var str:String = "This is string.";

var str1:String = new String("This is new string.");  

var str2:String = new String(str);

var str3:String = new String();

var str4:String = "This's \'Brijesh Kumar\'";

myText1.text = str;

myText2.text = str1;

myText3.text = str2;

myText4.text = str4;

}

]]>

</fx:Script>

<s:Panel width="200" height="200" title="String Class Panel" backgroundColor="0x81B5AA">

<s:VGroup>

<mx:Text id="myText1"/>

<mx:Text id="myText2"/>

<mx:Text id="myText3"/>

<mx:Text id="myText4"/>

</s:VGroup>

</s:Panel>

</s:Application>

 Output:-

Download this code

Advertisements

Posted on: June 3, 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.