shithub: mc

ref: 4696e9dc4fda1400c881f2177183da3b024633f1
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)
}