Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views

class11-cs-ch10-(part2)

The document discusses string functions in Python, which are pre-defined methods for string manipulation. It categorizes these functions into computational, conversion, and comparison types, providing examples such as len(), upper(), and isalpha(). Additionally, it explains the usage of commonly used functions like startswith() and endswith() with examples.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

class11-cs-ch10-(part2)

The document discusses string functions in Python, which are pre-defined methods for string manipulation. It categorizes these functions into computational, conversion, and comparison types, providing examples such as len(), upper(), and isalpha(). Additionally, it explains the usage of commonly used functions like startswith() and endswith() with examples.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Class XI

Computer Science(083)

CH-10 : STRING MANIPULATION


TOPIC : “STRING FUNCTIONS”

1
STRING FUNCTIONS :
2

 Functions are pre-defined , built-in methods used to


perform specific task.

 Python offers many built-in functions for string


manipulation.

 Syntax : stringobject.function name ( )


Different types of String Functions:
3

 Computational: It compute and returns numeric


value. It include:
 len()
 count()

 index()

 find()
Contd…
4

 Conversion : It converts the value and returns a new


string .It include :
 upper()
 lower()
 capitalize()
 title()
 replace()
 lstrip()
 rstrip()
 strip()
 join()
 split()
 partition()
Contd…
5

 Comparison : It compare the string and returns boolean


value. It include:
 isupper()
 islower()
 isalpha()
 isdigit()
 isalnum()
 isspace()
 istitle()
 startswith()
 endswith()
Commonly used String Functions:
(defination with example)
6
contd….:
7
Contd..
8
contd…:
9
Some more String Functions:
10
contd..:
11
Contd..:
12

•startwith() : this function returns True if the string starts with the substring sub , otherwise
returns False.
>>> ABCD.startswith(“A”)
True

•endswith() : this function returns True if the string ends with the substring sub , otherwise
returns False.
>>> ABCD.endswith(“A”)
False
>>>ABCD.endswith(“CD”)
Single Character Functions:
13

You might also like