0% found this document useful (0 votes)
10 views5 pages

11 String 11 Nov

Uploaded by

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

11 String 11 Nov

Uploaded by

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

String build in functions:

Method Description Example


len() Returns the length of the given >>> str1 = 'Hello World!' >>>
string len(str1)
12

title() Returns the string with first letter >>> str1 = 'hello WORLD!' >>>
of every word in the string in str1.title()
uppercase and rest in lowercase 'Hello World!'

lower() Returns the string with all >>> str1 = 'hello WORLD!' >>>
uppercase letters converted to str1.lower()
lowercase 'hello world!'

upper() Returns the string with all >>> str1 = 'hello WORLD!' >>>
lowercase letters converted to str1.upper()
uppercase 'HELLO WORLD!'
count(str, start, end) Returns number of times substring >>> str1 = 'Hello World! Hello
str occurs in the given string. If we Hello'
do not give start index and end >>> str1.count('Hello',12,25) 2
index then searching starts from >>> str1.count('Hello')
index 0 and ends at length of the 3
string

You might also like