Check out example codes for "str[i] - '0'". It will help you in understanding the concepts better.

Code Example 1

The part str[i] - '0' takes the ASCII character of the corresponding digit 
which are sequentially "0123456789" and subtracts the code for '0' from the 
current character. This leaves a number in the range 0..9 as to which digit is 
in that place in the string.

Learn ReactJs, React Native from akashmittal.com