For the Compleat Fan
-
pjot
- Posts: 733
- Joined: Thu Feb 26, 2004 10:19 pm
- Location: The Hague, The Netherlands
-
Contact:
Post
by pjot »
Hi,
Using newLisp 8.1.5, also occuring with 8.1.4. The following line works OK in Windows:
> (parse (date (apply date-value (now))) " ")
("Fri" "Sep" "3" "22:21:36" "2004")
So this is OK. An 'nth 3' delivers the time. In Linux however, the result is different:
> (parse (date (apply date-value (now))) " ")
("Fri" "Sep" "" "3" "22:21:36" "2004")
I have to use an 'nth 4' to get the time here. An extra list entity is returned, an entity which is empty: "".
How come this difference occurs?
Peter
-
Lutz
- Posts: 5289
- Joined: Thu Sep 26, 2002 4:45 pm
- Location: Pasadena, California
-
Contact:
Post
by Lutz »
On Linux/UNIX there is an extra space to account for 2-digit days to make the whole date string constant length and your are parsing with one space.
Do the following and you will be fine:
(parse date-string "[ ]+" 0) ; break at on or more spaces
;; or
(parse date-string "\\s+" 0)
Lutz
-
pjot
- Posts: 733
- Joined: Thu Feb 26, 2004 10:19 pm
- Location: The Hague, The Netherlands
-
Contact:
Post
by pjot »
And again, newLisp appears to be smarter than I am... :-) Thank you.