shithub: mc

ref: 6ed494853cfc436672cc3d296f42034ea475dd40
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)
		-> str[pfx.len:]
	else
		-> str
	;;
}