view samples/stringops.tp @ 161:fc8eecad71e6

Fix variable name collision in integer objects
author Mike Pavone <pavone@retrodev.com>
date Sat, 10 Aug 2013 18:26:33 -0700
parents 38140b7dbe3d
children 32964a4e7a33
line wrap: on
line source

#{
	main <- {
		print: "foo: " . 42 . "\n"
		print: (string: (length: "foo" . "bar")) . "\n"
		print: (string: ("foobarbaz" find: "foo" else: { "not found" })) . "\n"
		print: (string: ("foobarbaz" find: "bar" else: { "not found" })) . "\n"
		print: (string: ("foobarbaz" find: "baz" else: { "not found" })) . "\n"
		print: (string: ("foobarbaz" find: "qux" else: { "not found" })) . "\n"

		print: ("foobarbaz" from: 3) . "\n"
		print: ("foobarbaz" from: 3 withLength: 3) . "\n"

		foreach: ("foo,bar,baz,qux" splitOn: ",") :idx val {
			print: val . "\n"
		}

		res <- "foobarbaz" partitionOn: "bar"
		print: "Before: " . (res before) . "\n"
		print: "After: " . (res after) . "\n"

		print: (string: ("12abcDEF" parseHex32)) . "\n"
		print: (string: ("FFFFFFFFFF" parseHex64)) . "\n"
	}
}