shithub: mc

ref: 905f4d10a78e7e2f6eb849cf373b14cd78c87d73
dir: /test/strsplit.myr/

View raw version
use std

const main = {
	var i
	var sp

	sp = std.strsplit("a,b,c,d", ",")
	for i = 0; i < sp.len; i++
		std.put("\"{}\"\n", sp[i])
	;;
	std.slfree(sp)

	sp = std.strsplit("a,,b,c,,d", ",")
	for i = 0; i < sp.len; i++
		std.put("\"{}\"\n", sp[i])
	;;
	std.slfree(sp)

	sp = std.strsplit("a--b---b--c---c-d--d", "---")
	for i = 0; i < sp.len; i++
		std.put("\"{}\"\n", sp[i])
	;;
	std.slfree(sp)
}