From: dylanthomasfan
Subject: How do I tokenize strings returned by getenv in init.el
Date: 
Message-ID: <1177081687.855678.267300@n76g2000hsh.googlegroups.com>
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.

From: dylanthomasfan
Subject: Re: How do I tokenize strings returned by getenv in init.el
Date: 
Message-ID: <1177085141.689649.294680@b75g2000hsg.googlegroups.com>
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.
From: Frank Buss
Subject: Re: How do I tokenize strings returned by getenv in init.el
Date: 
Message-ID: <10pmy6vyc9jfl$.106q46ghh8988.dlg@40tude.net>
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