String methods help you to work with strings

String Length

The ln property returns the length of a string:

syntax

1
len(string)

example

1
2
3
4
5
6
7
8
#string
string = "hello world! how are you"

#len() method 
length = len(string)

#print
print(length)

output

24

Finding a String in a String

syntax

1
find = string.find('string')

example

1
2
3
4
5
6
7
8
string = "hello world! how are you"

#find method
find = string.find('world')

#print

print(find)

python counts positions from zero

output

6

Spliting string

syntax

1
string.split()

example

1
2
3
4
5
6
7
string = "hello world! how are you"

#split method
spliting = string.split()

#print
print(spliting)

output

['hello', 'world!', 'how', 'are', 'you']

English today is not an art to be mastered it's just a tool to use to get a result