[Zope] string splitting

Nick Garcia ngarcia@codeit.com
Wed, 18 Aug 1999 09:08:20 -0700 (PDT)


If you were doing it in DTML, then you'd do this:

<!--#var "_.string.split(thestring, '&')[0]"-->
To get the first part, and:
<!--#var "_.string.split(thestring, '&')[1]"-->
To get the second part.

Although, I suppose you could do:
<!--#call "REQUEST.set(myVar, _.string.split(thestring, '&')"-->

And then use:
<!--#var "myVar[0]"-->
and
<!--#var "myVar[1]"-->
but I haven't tried that yet.

You'll have to pardon my use of the old syntax, but I haven't had time to
move over to the new one yet.

Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com

On Wed, 18 Aug 1999 wombat_harness@hotmail.com wrote:

> Hi everyone,
> 
> can anyone tell me how to split strings at a specific character. I have
> got a variable that is made up of two parts seperated by a '&' and i
> need to split the string up. Has anyone got the code for this??
> 
> Thanks for your help,
> 
> Wom.