[html5] How to test for cents currency symbol in javascript

Andrew Byrne byrneandrew46 at gmail.com
Sat May 24 05:42:54 PDT 2014


Ouch testing for a symbol!?
I'm also thinking its a UTF8 / ISO char set thing.
But the ¢ is a presentation issue can you test for something a little
less ambiguous like using modulo to find the presence of a decimal.



Regards,

*Andrew Byrne*
M.0402048054





On Sat, May 24, 2014 at 10:19 PM, Larry Martell <larry.martell at gmail.com>wrote:

> I need to test for the cents currency symbol in my JavaScript program.
>
> I have a variable with this value:
>
> ¢40.36
>
> In my program I do this:
>
> ax = (a[0][0] == '¢');
>
> When my program run ax is False. But from the console it evaluates to True:
>
> >>> a[0]
> "¢40.36"
> >>> ax
> false
> >>> a[0][0] == '¢'
> true
> >>> ax = (a[0][0] == '¢')
> true
> >>> ax
> true
>
> Can anyone explain this odd inconsistency and tell me how I can test
> for the cents character?
> _______________________________________________
> Help mailing list
> Help at lists.whatwg.org
> http://lists.whatwg.org/listinfo.cgi/help-whatwg.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/help-whatwg.org/attachments/20140524/0dbab871/attachment.htm>


More information about the Help mailing list