[Zope] Re: mid function!
Dieter Maurer
dieter@handshake.de
Mon, 13 Aug 2001 20:56:05 +0200 (CEST)
Hamzat kamal writes:
> >I assumed this will serve my purpose but when i tried it,
You are probably wrong...
> <dtml-var dname>
> <dtml-if expr="_.find(dname, sub[1,6])=='Sunday'">
> today is sunday
> </dtml-if>
"find" returns an index, i.e. an integer. It will always be different
from a string ('Sunday').
You have been told to use the slice syntax:
<dtml-if expr="dname[0:6] == 'Sunday'">
Why do you not follow this advice?
You probably would start with
<dtml-var expr="dname[0:6]">
to get a feeling how slicing works...
You can do that in an interactive Python interpreter (to save time):
python
>>> s='your string'
>>> s[0:6]
But you can do it in DTML, too.
Dieter