Howdy Gabriele:
>Ok Jeff, but why does PARSE behave like that? I suppose there's
>a reason for that... Furthermore, I think that using rules is slower
>than letting parse do the split in native code...
Well, can't speak for Carl's intentions when he
implemented PARSE, but I think someone already mentioned
it, that double quotes serve to preserve meaningful
whitespace.
PARSE string NONE is shortcut really for a basic parsing
rule, namely "break the string up by spaces, except for
spaces surrounded by quotes". Handing PARSE another
rule which says "break the string up by spaces only" is
going to be about the same difference efficiency wise
(PARSE is efficient to start with), so who's to say
which behavior is going to be more commonly desired
rule? I myself can imagine the need for breaking up
databases that look like this:
John Doe Z. "14 Mockingbird way" #123-321-1231
Jane Doe A. "13 Mockingbird way" #123-321-1242
Jake Doe W. "12 Mockingbird way" #123-321-1253
read the thing line at a time, maybe, PARSEing with NONE
and then you can just do a
SET [first-name Last-name middle-I address phone]
and there you go... Let's say it's the other way around
(parse str none ONLY breaks the string on spaces) and
you want to generate a PARSE rule that breaks it up
based on spaces except preserving quoted spaces? How's
that going to look? And which will be more commonly
used... ?
Well, I'm speculating, anyhow.. but I'll ask Carl about
that behavior when I get the chance sometime...
(-:
-jeff