0

Num = num + s.charAt(0)-'0';

Why substraction of char '0'

17th Mar 2021, 6:35 AM
🤔☺️😳😇
4 Réponses
+ 3
char codes: '0' : 48 '1' : 49 '2' : 50 ... digit char - '0' == numeric digit
17th Mar 2021, 6:41 AM
visph
visph - avatar
+ 1
to get numeric value of digit from its char code ^^
17th Mar 2021, 6:37 AM
visph
visph - avatar
0
I am not getting you
17th Mar 2021, 6:39 AM
🤔☺️😳😇