shithub: mc

ref: bc046635d6368a7e81bcc172efb121d54b05ebcd
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
	;;
}