Hi Thomas,

Thanks, first of all, but I think that doesn't handle varying numbers
of spaces as I wish:

: (setq S "Now    is    the     time")
-> "Now    is    the     time"
: (use @A @B @C (match '(@A " " @B " " @C) (chop S)) (list @A @B @C))
-> (("N" "o" "w") (" ") (" " "i" "s" " " " " " " " " "t" "h" "e" " " "
" " " " " " " "t" "i" "m" "e"))

@B got the second space, because there were three spaces in a row.

What I did works, but the loop to get rid of all of the NILs can be long.

Regards,
- Rand



On Sat, Apr 25, 2009 at 12:36 AM, Tomas Hlavaty <t...@logand.com> wrote:
> Hi Randall,
>
>> I read a line, which looks something like:
>>
>> 01/02/2009 =C2=A0 30.00 =C2=A0 =C2=A0400.00 =C2=A0 =C2=A0t =C2=A0 =C2=A0=
Randall Dow
>>
>> in which the fields are separated by a varying number of spaces.
>> That gets put into L, and then I delete the NILs that come
>> from multiple spaces. =C2=A0Do you have a suggestion for a better
>> way than this:
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let L (mapcar pack (split (lin=
e) " "))
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (loop
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(NIL (memq=
 NIL L))
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq L (d=
elete NIL L)) )
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ....
>
> not sure how do you use the parsed fields but what about something
> like:
>
> (use (@A @B @C @D @E)
> =C2=A0 (when (match '(@A " " @B " " @C " " @D " " @E) (line))
> =C2=A0 =C2=A0 =C2=A0(mapcar clip (list @A @B @C @D @E)) ) )
>
> will return the five fields in a list without the delimiting spaces.
>
> Cheers,
>
> Tomas
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to