Skip to content

Commit 668e952

Browse files
author
vijay patel
committed
added Formating validating
1 parent 269f370 commit 668e952

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#######################################
2+
####### Pyhton String validating Example
3+
#######################################
4+
5+
example="python"
6+
7+
8+
print("String validating for lowercase")
9+
print(example.islower())
10+
# String validating for lowercase
11+
# True
12+
13+
example="python"
14+
print("String validating for Upper case")
15+
print(example.isupper())
16+
# String validating for Upper case
17+
# False
18+
19+
example="Python Example"
20+
print("String validating for Title case")
21+
print(example.istitle())
22+
# String validating for Title case
23+
# True
24+
25+
example=" "
26+
print("String validating for is having only space")
27+
print(example.isspace())
28+
# String validating for is having only space
29+
# True
30+
31+
example="123asd"
32+
print("String validating for is having alphanumeric")
33+
print(example.isalnum())
34+
# String validating for is having alphanumeric
35+
# True
36+
37+
example="123asd"
38+
print("String validating for is having alphabets")
39+
print(example.isalpha())
40+
# String validating for is having alphabets
41+
# False
42+
43+
example="123"
44+
print("String validating for is having onlyu digits")
45+
print(example.isdigit())
46+
# String validating for is having onlyu digits
47+
# True
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#######################################
2+
####### Pyhton String Formating Example
3+
#######################################
4+
5+
example="hello"
6+
7+
print ("center 5 function example")
8+
string=example.center(5)
9+
print(string)
10+
#output is
11+
#center 5 function example
12+
#hello
13+
14+
print ("center 7 function example")
15+
print(example.center(7))
16+
#output is
17+
# center 7 function example
18+
# hello
19+
20+
21+
print ("center 9 function example")
22+
print(example.center(9))
23+
#output is
24+
# center 9 function example
25+
# hello
26+
27+
28+
print ("center 9 with * function example")
29+
print(example.center(9,'*'))
30+
#output is
31+
# center 9 with * function example
32+
# **hello**
33+
34+
print ("left justification example output is")
35+
print(example.ljust(7))
36+
# ljustification example output is
37+
# hello
38+
39+
print ("left justification with * example output is")
40+
print(example.ljust(7,'*'))
41+
# ljustification with * example output is
42+
# hello**
43+
44+
print ("right justification example output is")
45+
print(example.rjust(7))
46+
# right justification example output is
47+
# hello
48+
49+
print ("right justification with * example output is")
50+
print(example.rjust(7,'*'))
51+
# right justification with * example output is
52+
# **hello
53+
54+
55+
print ("Zfilling 5 example output is")
56+
print(example.zfill(5))
57+
# Zfilling 5 example output is
58+
# hello
59+
60+
print ("Zfilling 7 example output is")
61+
print(example.zfill(7))
62+
# Zfilling 7 example output is
63+
# 00hello
64+
65+
print ("Zfilling 9 example output is")
66+
print(example.zfill(9))
67+
# Zfilling 9 example output is
68+
# 0000hello

0 commit comments

Comments
 (0)