String Manipulation Functions
String Manipulation Functions
Python allows you to use the following built-in functions to manipulate strings. They do not change
the original string but return a new string which has been changed in some way or return a number
or Boolean value. Please familiarise yourself with them (read, understand and remember).
Method Description
endswith() Returns true if the string ends with the specified value
find() Searches the string for a specified value and returns the
position of where it was found
index() Searches the string for a specified value and returns the
position of where it was found
islower() Returns True if all characters in the string are lower case
isupper() Returns True if all characters in the string are upper case
partition() Returns a tuple where the string is parted into three parts
rfind() Searches the string for a specified value and returns the
last position of where it was found
rindex() Searches the string for a specified value and returns the
last position of where it was found
rpartition() Returns a tuple where the string is parted into three parts
startswith() Returns true if the string starts with the specified value
swapcase() Swaps cases, lower case becomes upper case and vice
versa