Well, sometimes to discover you ought to try ;)

I built you a little sample-application showing the results of
parseFloat and Number() (and 'as Number', which gives, lets say
'predictable', results when used on a String)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
        creationComplete="showNumbers()"
>
        <mx:Script>
                <![CDATA[
                        private function showNumbers():void
                        {
                                var stringNumbers:Array = ["123", "12.3", 
"1,23", "123abc",
"abc123", "12ac3"];
                                
                                var output:String = "";
                                for (var s:String in stringNumbers) {
                                        output += "\nresult for " + 
stringNumbers[s] + ":";
                                        output += "\n\tNumber():\t\t" + 
Number(stringNumbers[s]);
                                        output += "\n\tparseFloat():\t" + 
parseFloat(stringNumbers[s]);
                                        output += "\n\tas Number:\t" + 
(stringNumbers[s] as Number);
                                        output += "\n";
                                }
                                results.text = output;
                        }
                ]]>
        </mx:Script>
        
        <mx:Text id="results" />
</mx:Application>

--Johan


--- In flexcoders@yahoogroups.com, "reflexactions" <[EMAIL PROTECTED]>
wrote:
>
> Thanks anyway for the reply, though I wasnt really asking what the 
> difference is between Number and parseFloat I was asking more 
> specifically about the difference between Number and parseFloats 
> string parsing capabilities.


Reply via email to