Skip to content

Commit 5d347ed

Browse files
author
vijay patel
committed
added String joining & text wraping
1 parent 668e952 commit 5d347ed

14 files changed

+96
-311
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
########### Spliting Example ################
2+
example='abcd#efg#hijk#lamno$1$2$3$4'
3+
4+
split_example=example.split()
5+
print(split_example)
6+
#Output would be
7+
#String Spliting Example
8+
#['abcd#efg#hijk#lamno$1$2$3$4']
9+
10+
split_example=example.split('#')
11+
print ("String Spliting Example")
12+
print(split_example)
13+
#Output would be
14+
#String Spliting Example
15+
#['abcd', 'efg', 'hijk', 'lamno$1$2$3$4']
16+
17+
18+
########### Joining Example ################
19+
20+
example=['ABC','DEF','GHI','JKL']
21+
join_example=''.join(example)
22+
print ("String Join Example")
23+
print(join_example)
24+
#Output would be
25+
#String Join Example
26+
#ABCDEFGHIJKL
27+
28+
join_example=' * * '.join(example)
29+
print ("String Join Example")
30+
print(join_example)
31+
#output would be
32+
#String Join Example
33+
#ABC * * DEF * * GHI * * JKL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
########### String find Example ################
2+
3+
example="A#B#C#D$1$2$3"
4+
find_example=example.find('1')
5+
6+
print ("value 1 location in string is",find_example)
7+
#Output would be
8+
#('value 1 location in string is', 8)
9+
10+
print ("value from string at 8 index is",example[8])
11+
#Output would be
12+
#('value from string at 8 index is', '1')
13+
14+
find_example=example.find('4')
15+
16+
print ("value 4 in string",find_example)
17+
#Output would be
18+
#('value 4 in string', -1)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
########### String Coutning Example ################
2+
3+
example="A#B#C#D"
4+
count_example=example.count('#')
5+
6+
print ("Number of # in example string is",count_example)
7+
#Output would be
8+
#('Number of # in example string is', 3)
9+
10+
11+
count_example=example.count('#',0,4)
12+
13+
print ("Number of # in example string is",count_example)
14+
#Output would be
15+
#('Number of # in example string is', 2)

Python-String/String-Formating.py

-50
This file was deleted.

Python-String/String-Replacing.py

-24
This file was deleted.

Python-String/String-basic-condition.py

-29
This file was deleted.

Python-String/String-basic-declaration.py

-43
This file was deleted.

Python-String/String-convert-in-other-data-type.py

-26
This file was deleted.

Python-String/String-immutable.py

-12
This file was deleted.

Python-String/String-indexing-Slicing.py

-61
This file was deleted.

Python-String/string-concatation.py

-40
This file was deleted.

Python-String/string-repatation.py

-26
This file was deleted.

0 commit comments

Comments
 (0)