home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,909 of 117,927   
   dxf to Hans Bezemer   
   Re: Parsing timestamps?   
   29 Oct 24 20:25:24   
   
   From: dxforth@gmail.com   
      
   On 29/10/2024 4:07 am, Hans Bezemer wrote:   
   > ...   
   > I have put the complication elsewhere. If we assume we're working in   
   decimal, you don't even need >NUMBER:   
   >   
   > char 0 negate +constant 0-   
   >   
   > : /int    ( a1 n1 -- a2 n2 n3)   
   >   0 >r 1 >r 1- chars over +   
   >   begin   
   >    over 1- over <   
   >   while   
   >     dup c@ is-digit   
   >   while   
   >     dup c@ 0- r> tuck * r> + >r 10 * >r 1-   
   >   repeat over - rdrop r> -rot   
   > ;   
   > ...   
      
   So that's how to convert a numeric string from the other end.   
   Nice!  Easier than I imagined it would be.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca