[Python-checkins] CVS: python/dist/src/Objects stringobject.c
Barry A. Warsaw
bwarsaw@cnri.reston.va.us
Thu, 10 Jun 1999 18:43:26 -0400 (EDT)
Update of /projects/cvsroot/python/dist/src/Objects
In directory anthem:/projects/python/develop/bwarsaw/src/Objects
Modified Files:
Tag: string_methods
stringobject.c
Log Message:
Strings objects now have methods, a la JPython. The following methods
have been added:
capitalize
count
endswith
find
index
lstrip
lower
replace
rfind
rindex
rstrip
split/splitfields
startswith
strip
swapcase
translate
upper
Code which used to be written "import string; string.lower(s)" can now
be written s.lower() to return a new lowercased string. All string
module methods have similar translations. Methods startswith and
endwith are new -- no string module equivalents, but they are the same
as with Java strings
s.startswith(t [, offset]) returns 1 if s starts with the prefix
t, otherwise 0. Optional offset starts the comparison at that
position within the string.
s.endswith(t) returns 1 if s ends with the suffix t, otherwise 0