UNDERSTANDING STRING METHODS
Definition:- string methods are built in functions which are used to perform operations on strings
RULE FOR STRING METHODS:-
string.method name( )
- UPPER( )
Upper will convert all the lower case characters into upper case character.
example:-
2.LOWER( )
Lower will convert all the upper case characters into lower case character.
example:-
3.SWAP CASE( )
Swap case will convert all the upper case characters into lower and lower case characters into upper.
example:-
4.CAPITALIZE( )
Capitalize will convert the first character to upper case if it is an lower case alphabet, rest of the character will be ignored.
example:-
5.TITLE( )
Title will convert the first character of a word into upper case and rest will be in lower case.
example:-
6.COUNT( )
We can count the number of characters where a substring is present inside a string. count has a benefit of adding starting index & ending index
example:-
7.REPLACE( )
We can replace a substring with another substring
example:-
8.INDEX( )
Index method is used to return the location of a substring occuring in the first occurrence of a string.
example:-
9.FIND( )
Find method is also used to return the location of a substring occuring in the first occurance of a string.but the difference is it will give the output value as -1,when the substring does not exist.
Get Pendurvenu’s stories in your inbox
Join Medium for free to get updates from this writer.
example:-
10.STRIP( )
Strip will remove characters/elements from both the starting and ending of a string. the default string will be space.
example:-
11.LSTRIP( )
Lstrip will remove characters/elements from only the left side of a string.
example:-
12.RSTRIP( )
Rstrip remove characters/elements from only the right side of a string.
example:-
13.RFIND( )
Rfind method is used to return the location of a substring occuring in the right side of a string
example:-
14.RINDEX( )
Rindex method is used to return the location of a substring occuring in the right side of a string.
example:-
15.SPLIT( )
which will split your entire string into a substring based on the condition. it will split between the characters where the space is present.
example:-
16.RSPLIT( )
Rsplit will split your entire string into a substring from the right side of a string.
example:-
17.PARTITION( )
Partition is also a split method. Partition is always split 3 parts based in substring
=>before the split
=>split value itself
=>after the split
example:-
18.RPARTITION( )
Rpartition is used to split from the right side of a string
example:-







