ตัวอย่างการใช้เมธอด:
Python
text = " Hello, Python! "
print(text.upper()) # HELLO, PYTHON!
print(text.lower()) # hello, python!
print(text.capitalize()) # Hello, python!
print(text.strip()) # Hello, Python!
words = text.split(", ") # ['Hello', 'Python!']
new_text = text.replace("Python", "world") # Hello, world!
index = text.find("Python") # 7
length = len(text) # 17