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

Larry Martell larry.martell at gmail.com
Sun May 25 12:10:18 PDT 2014


Hi Martin-

On Sat, May 24, 2014 at 8:59 AM, Martin Gainty <mgainty at hotmail.com> wrote:
> you can knock this out with simple javascript

Well, my simple javascript doesn't work.

> OR
> you can use CurrencyTextBox from Dojo JavaScript library
> http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_validate.html

This is data in a table, not in a text box, so I don't think that
would work for me.

Thanks!
-larry

> From: byrneandrew46 at gmail.com
> Date: Sat, 24 May 2014 22:42:54 +1000
> To: larry.martell at gmail.com
> CC: help at lists.whatwg.org
> Subject: Re: [html5] How to test for cents currency symbol in javascript
>
>
> 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
>
>
>
> _______________________________________________ Help mailing list
> Help at lists.whatwg.org http://lists.whatwg.org/listinfo.cgi/help-whatwg.org


More information about the Help mailing list