-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStrOps.py
37 lines (30 loc) · 958 Bytes
/
StrOps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''
Created on Jun 17, 2017
@author: Coalesce
'''
# String types: single line, multi-line
strMessage='''This is a multiline
string statement
which needs \''' to
display it correctly.
it needs QUOTES to work. '''
#strMessage='this is a multiline\
# string statement. \
# which needs \''' to \n\
# display it correctly'
# Use \ for using " or ' multi-line strings
print("With capitalize():")
print(strMessage.capitalize())
print("With title():")
print(strMessage.title())
# # # # # # #
# String functions
centeredStr="Jiggy"
print("Centered: ")
print(centeredStr.center(11, '*'))
print("Justification: left, right")
print(centeredStr.ljust(20, '^'))
print(centeredStr.rjust(20, '^'))
print("Case-related functions: islower(), isupper()")
print(centeredStr.islower())
print(centeredStr.isupper())