[Zope] SV: [Zope] Newbie: String work

peter be peter@grenna.net
Tue, 27 Jun 2000 20:24:31 +0100


Hello Andy

the syntax should be 

let string = "fred~~bloggs~aardvark"

_.string.split(string,'~~')[-1]
i.e.
<dtml-var "_.string.split(string,'~~')[-1]">

Should work.

In python, it's the same thing. 

----- Original Message ----- 
From: Andy Gates <Andy.Gates@bristol.ac.uk>
To: <zope@zope.org>
Sent: Tuesday, June 27, 2000 12:39 PM
Subject: [Zope] Newbie: String work


> Simple stuff from the simple people today: string manipulation.
> 
> I have a string variable which has various chunks delimited by double 
> tildes ~~. In order to do what I need to do, I need to extract the 
> section of the string after the last double-tilde, so that
> 
> "fred~~bloggs" returns "bloggs"
> "fred" returns "fred"
> "fred~~bloggs~aardvark" returns "aardvark"
> 
> I can see that rfind is the thing I need to use, but as usual (gah! 
> newbie!) I'm stuck on the syntax.  Help!
> ----------------------
> Andy Gates, Learning and Research Technology
> Andy.Gates@bristol.ac.uk - ICQ#74362415
> 
> 
> _______________________________________________
> 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 )
>