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

Martin Gainty mgainty at hotmail.com
Sat May 24 05:59:31 PDT 2014


you can knock this out with simple javascript
OR
you can use CurrencyTextBox from Dojo JavaScript library
http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_validate.html

Martin 
___________________                                                                                                   


 
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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/help-whatwg.org/attachments/20140524/9dd0e705/attachment.htm>


More information about the Help mailing list