[Zope] string splitting
Alexander Staubo
alex@mop.no
Wed, 18 Aug 1999 13:23:43 +0200
This is in the DTML documentation, and also in the Python documentation
(check out the string module and the split function).
Example of use:
<dtml-var "_.string.split('a&b&c&d', '&')">
would yield a Python list like this:
['a', 'b', 'c', 'd']
So you could do something like:
<dtml-call "REQUEST.set('foo', _.string.split('a&b&c&d', '&'))">
<dtml-if "foo[0] == 'a'">
First element is 'a'.
</dtml-if>
--
Alexander Staubo http://www.mop.no/~alex/
"QED?" said Russell.
"It's Latin," said Morgan. "It means, 'So there you bastard'."
--Robert Rankin, _Nostramadus Ate My Hamster_
> -----Original Message-----
> From: wombat_harness@hotmail.com [mailto:wombat_harness@hotmail.com]
> Sent: 18. august 1999 13:10
> To: zope@zope.org
> Subject: [Zope] string splitting
>
>
> 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.
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
>
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>