Each char has a value. The value of the charachter '0' is not 0 (it's 48 iirc). The digits 0 to 9 are sequential, thus |4| is |0|+4. This can be used to translate digits to chars and back.
The same trick can be applied if you wish to encode words as numbers. If 'a' is encoded as 0, then any other letter's value can be found by deducting 'a' from it.