0% found this document useful (0 votes)
22 views2 pages

String Manipulation

Very nice book very very nice book

Uploaded by

manaskr009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

String Manipulation

Very nice book very very nice book

Uploaded by

manaskr009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

String Manipulation

String functions:
i) String.capitalize( ): It returns a copy of the string with its first character capitalized.
Ex: nm = ‘vishnu’
Rm = nm.capitalize( )
print(Rm)
Output: Vishnu
ii) String.isalnum( ): This function returns True if the characters in the string are
alphanumeric (alphabets or numbers); otherwise it returns False.
Ex: nm = ‘vishnu’
Rm = nm.isalnum( )
print(Rm)
Output: True

iii) String.isalpha( ): It returns True only if the given string contains alphabets as its
characters.
Ex: nm = ‘vishnu’
Rm = nm.isalpha( )
print(Rm)
Output: True

nm = ‘12345’
Rm = nm.isalpha( )
print(Rm)
Output: False

iv) String.isdigit( ): It returns True if a string contains only digits as its characters.
Ex: nm = ‘123456’
Rm = nm.isdigit( )
print(Rm)
Output: True

v) String.islower( ): It returns True if the given string contained only lower case
characters.
Ex: txt= ‘intelligent’
Res =txt.islower( )
print(Res)
Output: True
vi) String.upper( ): It returns True if the given string contained only upper case
characters.
Ex: txt= ‘intelligent’
Res =txt.isupper( )
print(Res)
Output: False
vii) String.lower( ): It returns the string by converting all its characters in lower case.
Ex: txt= ‘INTELLIGENT’
Res =txt.lower( )
print(Res)
Output: intelligent

viii) String.upper( ): It returns the string by converting all its characters in upper case.
Ex: txt = ‘superior’
Res = txt.upper( )
print(Res)
Output: SUPERIOR

You might also like