Home Tutorial Flex Flex4 Components String Class in Action Script3

 
 

String Class in Action Script3
Posted on: June 3, 2010 at 12:00 AM
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

Related Tags for String Class in Action Script3:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.