shithub: mc

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