s = 'my name is Mike.hi Mike.'
is_true = s.startswith('my name')
print(is_true) #True
print(s.find('Mike')) #11 前から検索
print(s.rfind('Mike')) #19 後ろから検索
print(s.title()) #My Name Is Mike.Hi Mike.
print(s.capitalize()) #My name is mike.hi mike.
print(s.upper()) #MY NAME IS MIKE.HI MIKE.
print(s.lower()) #my name is mike.hi mike.
print(s.count('m')) #2
print(s.replace('Mike', 'Nancy')) #my name is Nancy.hi Nancy.
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme