I want to tokenize the string returned by getenv. In my case, the
getenv returns a string of the following type
"stringA string B"
note the white space inbetween stringA and stringB.
How do I get stringB? If I can tokenize the string returned, I can
cons it and then cdr the new list, but I need to tokenize the values
returned by getenv.
Any help is appreciated.
I found a hack, so never mind:
(substring (getenv "SOMEENVIRONMENT_VARIABLE") x y)
On Apr 20, 11:08 am, dylanthomasfan <·················@gmail.com>
wrote:
> I want to tokenize the string returned by getenv. In my case, the
> getenv returns a string of the following type
>
> "stringA string B"
>
> note the white space inbetween stringA and stringB.
>
> How do I get stringB? If I can tokenize the string returned, I can
> cons it and then cdr the new list, but I need to tokenize the values
> returned by getenv.
>
> Any help is appreciated.
dylanthomasfan wrote:
> I want to tokenize the string returned by getenv. In my case, the
> getenv returns a string of the following type
>
> "stringA string B"
>
> note the white space inbetween stringA and stringB.
>
> How do I get stringB? If I can tokenize the string returned, I can
> cons it and then cdr the new list, but I need to tokenize the values
> returned by getenv.
You could use some nice hacks, like this one:
http://paste.lisp.org/display/7291
CL-USER > (split-string "stringA string B" #\Space)
("stringA" "string" "B")
or something like a de-facto standard packet for this task, like this:
http://www.cliki.net/SPLIT-SEQUENCE
or a full featured regex package, like these ones:
http://www.cl-user.net/asp/search?search=regex
If you want to parse more complicated things, you may take a look at these
packages, too:
http://www.cl-user.net/asp/libs/tputils-lexer
http://www.cl-user.net/asp/libs/cl-yacc
--
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de