[Zope] examples of string functions?

Martijn Pieters mj@antraciet.nl
Wed, 16 Jun 1999 21:48:14 +0200


At 14:09 16-6-99 , Graham Chiu wrote:
>Hi,
>
>Just looking for a simple DTML example of how to use the string
>functions.
>
>I wish to check to see if the first and last characters of a 
>sequence-key are a pipe character or not.

I have no generic examples, but a direct solution:

<!--#if "_['sequence-key'][-1:] == '|' or _['sequence-key'][:1] == '|'"-->

should do it. Strings are sequences in python, so you can slice them.


-- 
Martijn Pieters, Web Developer 
| Antraciet http://www.antraciet.nl 
| Tel: +31-35-7502100 Fax: +31-35-7502111 
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj 
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
------------------------------------------