Yeah I did exactly that already, even before asking the question. I was just asking the question of a larger group to see if there was something I might have missed before committing to overriding a function in an Adobe class that was just doing Number(string) :)
It easy to write a test and then find out later there is some situation you overlooked that then invalidates your original small test. --- In flexcoders@yahoogroups.com, "johantrax" <[EMAIL PROTECTED]> wrote: > > 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" <reflexactions@> > 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. >