1.1 --- a/tests/string.py Thu Dec 15 23:26:40 2016 +0100
1.2 +++ b/tests/string.py Thu Dec 15 23:27:05 2016 +0100
1.3 @@ -6,6 +6,20 @@
1.4 print s[5:] # world!
1.5 print s[1:10:2] # el ol
1.6 print s[10:1:-2] # drwol
1.7 +print s.find("w") # 6
1.8 +print s.find("w", 7) # -1
1.9 +print s.find("w", 0, 6) # -1
1.10 +print s.index("o") # 4
1.11 +
1.12 +try:
1.13 + print s.index("p") # should raise an exception
1.14 +except ValueError, exc:
1.15 + print 's.index("p"): value is not appropriate', exc.value
1.16 +
1.17 +print s.startswith("Hello") # True
1.18 +print s.startswith("world") # False
1.19 +print s.endswith("world!") # True
1.20 +print s.endswith("Hello") # False
1.21
1.22 s2 = "Hello worlds!"
1.23 print s2 # Hello worlds!