[Zope] SV: [Zope] Newbie: String work
Hello Andy the syntax should be let string = "fred~~bloggs~aardvark" _.string.split(string,'~~')[-1] i.e. Should work. In python, it's the same thing. - Original Message - From: Andy Gates <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> 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 > [EMAIL PROTECTED] - ICQ#74362415 > > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] 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 )
Re: [Zope] Newbie: String work
Message-ID: <[EMAIL PROTECTED]> Priority: NORMAL X-Mailer: Execmail for Win32 5.1 Build (9) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" > > > this is documented at > http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.4.4.2.3.html > - but not very newbie-friendly Perfecto! Thank you! AndyG ___ Zope maillist - [EMAIL PROTECTED] 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] R: [Zope] Newbie: String work
- Original Message - From: Andy Gates <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 27, 2000 1: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! Maybe is a little strange , but should work (I hope:) Or maybe is better to use split, is more readable PM ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Newbie: String work
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 : this is documented at http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.4.4.2.3.html - but not very newbie-friendly took me a long time to figure out how to use :-) -- Geir Bækholt web-developer/designer [EMAIL PROTECTED] http://www.funcom.com ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Newbie: String work
Andy Gates wrote: > > 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! what about (in convoluted DTML very lightly tested): )"> If you want the part after the ~~, you'll have to add +2 to the string index, like instr[ix+2:]. Making this fit for the 'fred' case is left as an exercise for the reader ;-=) hth Rik ___ Zope maillist - [EMAIL PROTECTED] 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] 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 [EMAIL PROTECTED] - ICQ#74362415 ___ Zope maillist - [EMAIL PROTECTED] 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 )