[REBOL] Displaying AM / PM times
From: john:thousand-hills at: 30-Aug-2001 20:35
I have a REBOL file I am using that presents bus schedules in a format
readable for the blind.
The data is dumped into an ASCII array, I read it by line and would like to
modify the line to include AM or PM before REBOL places the elements into
the HTML table.
I have sniped the code to reflect what is done with one single line.:
This is what the line looks like and it is tab delimited:
7:14 7:17 7:23 7:26 7:32 7:40 7:43 7:47 7:54 8:03 8:08 8:16 8:26
How can I change the data in d7 to read AM/PM before it goes to the
table, I need to retain the tabs?
Here is the code:
Time conversion works from console
ntime: func [time /local am][
time/3: 0
am: pick [" AM" " PM"] time < 12:00
if time >= 12:00 [time: time - 12:00]
if time/1 = 0 [time/1: 12]
rejoin [time am]
]
data: read/lines %route.txt
d7: pick data 7
either d7 [ s7: pick data 7 replace/all s7 tab "</CENTER></TD><TD
WIDTH=6%><CENTER>" s7: rejoin [ "<tr bordercolor=lightblue border=1
bgcolor=white><TD WIDTH=6%><CENTER>" s7 "</CENTER></TD></tr>" ] ] [ "" ]
john