+ 1

Will somebody tell me.

what is a substring.

12th Mar 2017, 11:21 PM
stephen haokip
stephen haokip - avatar
4 Respuestas
+ 12
it is a part of a string, for example: given the string "this is a string" here are some examples of substrings of it "this" "a string" "is a str" basically any sequence of letters that is also in the original string
12th Mar 2017, 11:28 PM
Burey
Burey - avatar
+ 1
a = "this is a string" >>> a[4:] ' is a string' >>> a[0:4] 'this' >>> a[10:] 'string' >>> a[::-1] 'gnirts a si siht'
12th Mar 2017, 11:32 PM
Stanislav Syarkevich
Stanislav Syarkevich - avatar
0
Do you mean slicing?
12th Mar 2017, 11:28 PM
Stanislav Syarkevich
Stanislav Syarkevich - avatar
0
A substring is a slice of a string, you use them when you need specific sections of a string
13th Mar 2017, 12:14 AM
Gareth W. Jones
Gareth W. Jones - avatar