shithub: mc

ref: 3af73a7086c91dd6b94b5407081e4a9c80014a5b
dir: /lib/std/chomp.myr/

View raw version
use "hasprefix"

pkg std =
	const chomp	: (str : byte[:], pfx : byte[:] -> byte[:])
;;

const chomp = {str, pfx
	if std.hasprefix(str, pfx)
		-> str[pfx.len:]
	else
		-> str
	;;
}