testString1 = "Hello World!"
print "Original String: "+ testString1
print "Converting to LowerCase"
print testString1.lower()
print "Converting to Upper Case"
print testString1.upper()
print "Capitalizing the String"
print testString1.capitalize()
print "Substring from index 1 to 7"
print testString1[1:8]
print "Substring from the start till character at index = 7 (start of string is index 0): "
print testString1[:8]
print "Substring from the character at index = 7, till the end of the string (remember: start of string is index 0): "
print testString1[7:]
print "Find the index from which the substring 'llo' begins within the test string"
print testString1.find('llo')
print "Now, let's look for a substring which is not a part of the given string"
print testString1.find('xxy')
print "Now, trying to find a substring between specified indexes only: looking for 'l' between 4 and 9"
print testString1.find('l',4,9)
print "find('l') on the given string returns the following index (scanning the string from left to right):"
print testString1.find('l')
print "rfind('l') on the given string returns the following index (this scans the string from right to left):"
print testString1.rfind('l')
print "Replacing World with Planet"
print testString1.replace("World","Planet")
print "Splitting the string into words, wherever there is a space"
print testString1.split(" ")
print testString1.rsplit(" ")
testString2 = "Hello World! "
print "Current Test String=" + testString2
print "Length (there are whitespaces at the end):" + `len(testString2)`
print "Length after stripping "+ `len(testString2.strip())`