Public feed #600444

Miscellany

public text v1 · immutable
Raw Edit
·published 2007-07-02 21:17 UTC
rendered paste body
: strLen // p --> len
 0
 OVER C@ IF
  BEGIN 1+ OVER OVER + C@ 0 = UNTIL
 THEN
 SWAP DROP
;

: StrToInt // p --> u
 DUP strLen
 1 OVER 0 DO 10 * LOOP 10 / SWAP
 0 SWAP OVER
 DO
  I 3 PICK + C@
  48 57 RANGE 48 -
  2 PICK * +
  SWAP 10 / SWAP
 LOOP
 2 XCHG DROP DROP
;