[Zope] another simple one

Tim Hicks tim@sitefusion.co.uk
Wed, 20 Feb 2002 19:07:09 -0000


> I need to split a variable out into two parts. The variable looks like
> this: 108243-132 and I need to split it where the - is. I can do this easy
> enough in Perl but this Zope server happens to be on a Wintendo 2000 box
> and I haven't been able to get perl working correctly with Zope. Is there
> an easy way to split a variable with dtml?

The best way is probably to use the string module.  The line below
(untested) should provide you with a variable in the REQUEST called
'your_split_variable_which_is_now_a_list' that is a list of the two halves
of your original variable.

<dtml-call "REQUEST.set('your_split_variable_which_is_now_a_list',
string.split(your_variable, '-'))">

hth

tim