-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98e83a0
commit b42d7ba
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
str="tech is BEST @19 #101" | ||
#methods | ||
#returns size of given str | ||
size=len(str) | ||
print(size) | ||
|
||
#returns an index of given str | ||
print(str.index("@19") ) | ||
|
||
#checking all chars are alphabets or digits | ||
print(str.isalnum() ) | ||
|
||
#checking all chars are alphabets | ||
print(str.isalpha() ) | ||
|
||
#checking all chars are digits | ||
print(str.isdigit() ) | ||
|
||
#checking all chars are digits | ||
print("5050".isdigit() ) | ||
|
||
#checking all chars are in upper case | ||
print(str.isupper() ) | ||
|
||
#checking all chars are in lower case | ||
print(str.islower() ) | ||
|
||
#checking all chars are space | ||
print(" ".isspace() ) | ||
|
||
#replecing old str with new new str | ||
print(str.replace("@19",'@2019') ) | ||
|
||
#capitalize | ||
print(str.capitalize() ) | ||
|
||
#swapping case | ||
print(str.swapcase() ) | ||
|
||
#counting no of occurances | ||
print(str.count('1') ) | ||
|
||
#splitting str by delimiter | ||
tokens= str.split(" ") | ||
print(tokens) |