[Zope] String manipulation

Gitte Wange gitte@mmmanager.org
03 Apr 2001 15:43:42 +0200


On 03 Apr 2001 11:43:31 +0200, Tino Wildenhain wrote:
> 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? 

Well it's a bit complicated - I think :-)

I am about to make these shows from a list of clips.
So you create a new shows, select it and then all availiable clips are
listed. You select the clips you want to add to your show and add them
to your playlist. Put them in the order you want and hit the save
button. Now the clips will be saved in the database together with the
show - in a comma-seperated list.

I have made some of the code in PHP - but haven't yet figured out how to
order the clips.

If you have any ideas you are welcome :-)

Regards,
Gitte
> 
> 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 )
> 
> _______________________________________________
> 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 )