$Header: /home/radek/cvs/forth-book/dictionary/qf/dict/to-digit,v 1.1 2003/12/28 18:21:58 radek Exp $
>digit — Převod znaku na číslo
>digit ( c → n )
: >digit ( c -- n ) DUP 64 > 9 and SWAP 15 and + ;
: >digit ( c -- n ) DUP 64 > 9 and + 15 and ;
: >CHAR ( n -- c ) \ Converts a number to its ASCII representation DUP 9 > [ CHAR A CHAR 9 - 1 - ] LITERAL AND + ASCII 0 + ;
: digit? ( c -- f ) \ test whether a char is a digit 0-9 [CHAR] 0 [ CHAR 9 1+ ] LITERAL WITHIN ;
: DIGIT ( u -- char ) DUP 9 > 7 AND + 48 + ;
: num>char ( u -- char ) DUP 9 > [ char A char 0 - 10 - ] literal and + [char] 0 + ;