Original String: Hello World!
Converting to LowerCase
hello world!
Converting to Upper Case
HELLO WORLD!
Capitalizing the String
Hello world!
Substring from index 1 to 7
ello Wo
Substring from the start till character at index = 7 (start of string is index 0):
Hello Wo
Substring from the character at index = 7, till the end of the string (remember: start of string is index 0):
orld!
Find the index from which the substring 'llo' begins within the test string
2
Now, let's look for a substring which is not a part of the given string
-1
Now, trying to find a substring between specified indexes only: looking for 'l' between 4 and 9
-1
find('l') on the given string returns the following index (scanning the string from left to right):
2
rfind('l') on the given string returns the following index (this scans the string from right to left):
9
Replacing World with Planet
Hello Planet!
Splitting the string into words, wherever there is a space
['Hello', 'World!']
['Hello', 'World!']
Current Test String=Hello World!
Length (there are whitespaces at the end):14
Length after stripping 12