You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2013/04/17 03:37:08 UTC

Currency formatting and formatting 0

Hi,

Old bugs are the best bugs - amazing this one been an issue for so long really. :-)

I added sample code and confirmed it's still an issue.

https://issues.apache.org/jira/browse/FLEX-26698

Funnily enough the spark formatter also have an different issue for formatting 0 so is not really a work around :-)

Should be easy to fix or patch if someone want's to try.

Thanks,
Justin

Re: Currency formatting and formatting 0

Posted by Justin Mclean <ju...@classsoftware.com>.
HI,

> 1) what about -0.4?
Yep that's fine.

> 2) is it safe to be looking for '.'?  What about other locales?
Also fine the "." is replaced later and there are mustella tests for that.

> 3) is it supposed to handle several leading zeros? As in: 000.2?
That I didn't check but is also fine.

I've added a few extra mustalla cases to test above. They all pass.

Thanks,
Justin



Re: Currency formatting and formatting 0

Posted by Alex Harui <ah...@adobe.com>.


On 4/17/13 12:36 AM, "Justin Mclean" <ju...@classsoftware.com> wrote:

> HI,
> 
> Actually a tiny bit trickier - but still a simple fix - see JIRA/Git check in.
I didn't look at the greater context, just the diff, but I'm wondering:
1) what about -0.4?
2) is it safe to be looking for '.'?  What about other locales?
3) is it supposed to handle several leading zeros? As in: 000.2?
-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: Currency formatting and formatting 0

Posted by Justin Mclean <ju...@classsoftware.com>.
HI,

Actually a tiny bit trickier - but still a simple fix - see JIRA/Git check in. 

May also be that scientific notation is also broken looking at the code.

Justin

Re: Currency formatting and formatting 0

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

Was a very simple fix - this:
// Handle leading zero if we got one give one if not don't
var position:Number = numStr.indexOf(".");
var leading:String = position > 0 ? "0" : "";

Should be:
// Handle leading zero if we got one give one if not don't
var position:Number = numStr.indexOf(".");
var leading:String = position == 0 ? "0" : "";

Thanks,
Justin