view samples/stringops.tp @ 151:3e9cb69e516d

Added from and from:withLength for doing substring operations
author Mike Pavone <pavone@retrodev.com>
date Fri, 09 Aug 2013 13:20:40 -0700
parents 7dfa4481deb0
children a6739206a9e3
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"
	}
}