Re: Reverse SCAN SPLIT

Liste des GroupesRevenir à cl forth 
Sujet : Re: Reverse SCAN SPLIT
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forth
Date : 07. Oct 2024, 13:07:16
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <586c9cbef8f2205264590221dd832e1c2cecdf35@i2pn2.org>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 7/10/2024 9:03 pm, Ahmed wrote:
And with 00 for hours and minutes when they are absent
 
: :t  ( add cnt -- add 2 1 | add1 2 add2 2 2 | add1 2 add2 2 add3 2 3)
 0 -rot bounds dup >r swap do
    i c@ [char] : = if 1+ i 1+ 2 rot then
 1 -loop 1+ r> 2 rot ;
 
: .t ( n --)
case
    1 of ." 00 hrs"   space ." 00 min" space type space ." sec" endof
    2 of ." 00 hrs"   space type space ." min" space type space ." sec"
endof
    3 of type space ." hrs"   space type space ." min" space type space
" sec" endof
endcase ;
 
 
s" 10:20:30" :t .t 10 hrs 20 min 30 sec ok
s" 20:30" :t .t 00 hrs 20 min 30 sec ok
s" 30" :t .t 00 hrs 00 min 30 sec ok

Interesting.  I'd do the numeric conversion in the main routine if possible.
There's a parsing issue with  s" :30"


Date Sujet#  Auteur
7 Oct 24 * Reverse SCAN SPLIT18dxf
7 Oct 24 +* Re: Reverse SCAN SPLIT6Ahmed
7 Oct 24 i`* Re: Reverse SCAN SPLIT5Ahmed
7 Oct 24 i `* Re: Reverse SCAN SPLIT4dxf
7 Oct 24 i  `* Re: Reverse SCAN SPLIT3Ahmed
8 Oct 24 i   `* Re: Reverse SCAN SPLIT2dxf
8 Oct 24 i    `- Re: Reverse SCAN SPLIT1Ahmed
7 Oct 24 +* Re: Reverse SCAN SPLIT2Ruvim
7 Oct 24 i`- Re: Reverse SCAN SPLIT1dxf
7 Oct 24 +- Re: Reverse SCAN SPLIT1dxf
10 Oct 24 +- Re: Reverse SCAN SPLIT1dxf
10 Oct 24 `* Re: Reverse SCAN SPLIT7albert
10 Oct 24  `* Re: Reverse SCAN SPLIT6dxf
17 Oct 24   +- Re: Reverse SCAN SPLIT1minforth
17 Oct 24   `* Re: Reverse SCAN SPLIT4mhx
18 Oct 24    +- Re: Reverse SCAN SPLIT1dxf
18 Oct 24    `* Re: Reverse SCAN SPLIT2dxf
19 Oct 24     `- Re: Reverse SCAN SPLIT1albert

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal