2016-12-01 | Paul Boddie | file changeset files shortlog | Introduced the itemaccess class as the base of sequence types and strings. Added support for obtaining substrings from strings. Added tests of string operations. Removed the superfluous _tuple function from the sequence module. |
paul@292 | 1 | s = "Hello" |
paul@292 | 2 | s += " world!" |
paul@292 | 3 | print s # Hello world! |
paul@292 | 4 | |
paul@292 | 5 | s2 = "Hello worlds!" |
paul@292 | 6 | print s2 # Hello worlds! |
paul@292 | 7 | print s < s2 # True |
paul@292 | 8 | print s <= s2 # True |
paul@292 | 9 | print s == s2 # False |
paul@292 | 10 | print s != s2 # True |
paul@292 | 11 | print s >= s2 # False |
paul@292 | 12 | print s > s2 # False |
paul@292 | 13 | |
paul@292 | 14 | print s[0] # H |
paul@292 | 15 | print s[-1] # ! |