[Zope] splitting strings ??

Martijn Faassen m.faassen@vet.uu.nl
Thu, 06 Jan 2000 13:22:01 +0100


Geir B Hansen wrote:
> 
> i'm not very knowledgeable in the ways of python,

The Python tutorial and the standard library reference which you can get
at
www.python.org are highly recommended!

> but i've found out
> how to split strings by separators :
> for example :
> <dtml-if expr="_.string.split(_['REMOTE_ADDR'],'.')[1] == '71'">etc...
> 
> how do i reference the *last* character of a string, not using any
> separators ??

I'm not quite sure what you mean by 'the last character of a string, not
using any separators', but 'the last character of a string', I can
answer:

if s is a string, then:

s[-1]

refers to its last character.

Regards,

Martijn