annotate samples/stringops.tp @ 259:32964a4e7a33

Add ltrim method to string
author Michael Pavone <pavone@retrodev.com>
date Thu, 29 May 2014 18:51:15 -0700
parents 38140b7dbe3d
children a4c2b31acba7
rev   line source
pavone@43 1 #{
pavone@43 2 main <- {
pavone@43 3 print: "foo: " . 42 . "\n"
pavone@43 4 print: (string: (length: "foo" . "bar")) . "\n"
pavone@150 5 print: (string: ("foobarbaz" find: "foo" else: { "not found" })) . "\n"
pavone@150 6 print: (string: ("foobarbaz" find: "bar" else: { "not found" })) . "\n"
pavone@150 7 print: (string: ("foobarbaz" find: "baz" else: { "not found" })) . "\n"
pavone@150 8 print: (string: ("foobarbaz" find: "qux" else: { "not found" })) . "\n"
pavone@151 9
pavone@151 10 print: ("foobarbaz" from: 3) . "\n"
pavone@151 11 print: ("foobarbaz" from: 3 withLength: 3) . "\n"
pavone@152 12
pavone@152 13 foreach: ("foo,bar,baz,qux" splitOn: ",") :idx val {
pavone@152 14 print: val . "\n"
pavone@152 15 }
pavone@152 16
pavone@152 17 res <- "foobarbaz" partitionOn: "bar"
pavone@152 18 print: "Before: " . (res before) . "\n"
pavone@152 19 print: "After: " . (res after) . "\n"
pavone@158 20
pavone@158 21 print: (string: ("12abcDEF" parseHex32)) . "\n"
pavone@158 22 print: (string: ("FFFFFFFFFF" parseHex64)) . "\n"
pavone@259 23 print: "'" . (" \nfoobar baz " ltrim) . "'\n"
pavone@43 24 }
pavone@43 25 }