vendredi 27 février 2015

How do you get the numerical value from a string of digits?

I need to add certain parts of the numerical string.


for example like.


036000291453


I want to add the numbers in the odd numbered position so like


0+6+0+2+1+5 and have that equal 14.


I tried the charAt(0)+charAt(2) etc, but it returns the digit at those characters instead of adding them. Thanks for your help.


Aucun commentaire:

Enregistrer un commentaire