We can represent any kind of object in the form of string. For this purpose we have used toString() method for any kind of object.
We can represent any kind of object in the form of string. For this purpose we have used toString() method for any kind of object.Object representation in to String example:-
We can represent any kind of object in the form of string. For this purpose we have used toString() method for any kind of object. User can see that process in this example.
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[ myText1.text = num.toString(); myText2.text = bool.toString(); myText3.text = currdate.toString(); } ]]> </fx:Script> <s:Panel width="210" height="110" title="Convert other object to String" backgroundColor="0x81B5AA"></s:Application> |
In this example we have created three objects that's types is Number, Boolean, Date. We have used toString() method to represent these objects in to string.
Output:-
