[Zope] String manipulation
Tino Wildenhain
tino@wildenhain.de
Tue, 03 Apr 2001 11:43:31 +0200
Hi Gitte,
I think you schould get a little bit familar with python
itself. The tutorial at python.org is a good starting point.
Everything in Zope which is noteted in the expr= Attribute
are python expressions.
Please try to not make to much code in dtml, since dtml is
thougt for inserting output into html or such, not so much
for logic (althougt you can do very much logic with it if
you really want)
In pyton methods or external methods you would use something like this:
import string
list=string.split(comma_seperated_string,',')
(this is only a fraqment that does not cover parameter passing and
result
returning)
In dtml, however you can use
_.string.split(comma_seperated_string,',')
The oposite function to split is join:
_.string.join(list,',')
if you want to assign the list to something to work with:
<dtml-call
expr="REQUEST.set('list',_.string.split(comma_seperated_string,','))">
What are you up to do with the list?
Regards
Tino
Gitte Wange wrote:
>
> Hello,
>
> I am looking for some functions to manipulate som strings (these are
> dtml-var's).
> E.g. I have a comma-separeted string I need to convert to an array (and
> back again).
>
> Any good how-to's
>
> Regards,
> --
> ************************
> Gitte Wange Jensen
>
> System Squid Developer
> MMManager Aps
> +45 29 72 79 72
>
> gitte@mmmanager.org
> ************************
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )