Hi Lutz,
This may be an obvious issue, but anyway:
-----------------
#!/usr/bin/newlisp
#
# Testing the 'parse' instruction
#
(set 'var (parse "Lutz Mueller created newlisp 127.0.0.1"))
(println var)
(exit)
-----------------
Now, the result of this program is:
("Lutz" "Mueller" "created" "newlisp" "127.0" ".0" ".1")
It strikes me that the IP address is splitted as well. The documentation mentions that "...when no str-break is given, parse tokenizes according newLISP's internal parse rules." However, it seems logical to expect something like the following, using space as splitter:
("Lutz" "Mueller" "created" "newlisp" "127.0.0.1")
Can you clarify in this situation the internal parse rule? I am using newLisp 8.1.0 on Slackware 9.1 Linux.
Thanx,
Peter
Peculiar behaviour of 'parse'?
-
- Posts: 429
- Joined: Tue Nov 11, 2003 2:11 am
- Location: Brisbane, Australia
OK, I figured that, but I didn't expect it since it seems not so consequent: the first part of the string is parsed as string, using whitespace as separator; the second part as float, obviously depending on the contents of that last part of the string.
The 'parse' command is probably more intelligent than I expected it to be... (When the str-break is defined as " ", the parse works as expected.)
The 'parse' command is probably more intelligent than I expected it to be... (When the str-break is defined as " ", the parse works as expected.)