shithub: mc

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