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,852 of 117,927    |
|    dxf to All    |
|    Reverse SCAN SPLIT    |
|    07 Oct 24 19:52:15    |
      From: dxforth@gmail.com              Earlier I mentioned scanning in reverse. Here's an implementation.              [undefined] dxforth [if]       : \CHAR ( a u -- a2 u2 c ) 1- 2dup + c@ ;       [then]              \ As for SCAN but scan from end       : SCAN< ( a u c -- a2 u2 | a 0 )        >r over swap begin dup while \char r@ = until 1+ then        rot drop rdrop ;              \ As for SPLIT but scan from end. Latter string is topmost.       : SPLIT< ( a u c -- a2 u2 a3 u3 )        >r 2dup r> scan< 2swap 2 pick /string ;              \ example              : /T ( a u -- hour min sec )        3 0 do        [char] : split< 0 0 2swap >number 2drop drop -rot        ( u ... a u) dup if 1- then        loop 2drop swap rot ;              : T /t cr rot . ." hr " swap . ." min " . ." sec " ;              s" 1:2:3" t       s" 02:03" t       s" 06:" t       s" 03" t       s" 23:59:59" t       s" 0:00:03" t              --- 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