on Tuesday, June 27, 2000 Andy Gates wrote :
AG> Simple stuff from the simple people today: string manipulation.

AG> I have a string variable which has various chunks delimited by double 
AG> tildes ~~. In order to do what I need to do, I need to extract the 
AG> section of the string after the last double-tilde, so that

AG> "fred~~bloggs" returns "bloggs"
AG> "fred" returns "fred"
AG> "fred~~bloggs~aardvark" returns "aardvark"

AG> I can see that rfind is the thing I need to use, but as usual (gah! 
AG> newbie!) I'm stuck on the syntax.  Help!

try something like :

<dtml-var expr="_.string.split('fred~~bloggs','~~')[-1]">

this is documented at
 - but not very newbie-friendly

 took me a long time to figure out how to use :-)

Geir Bækholt

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to