String Class in Action Script3


 

String Class in Action Script3

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

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>

0

</s:Panel>

</s:Application>

 Output:-

1

Download this code

Ads