shithub: mc

ref: eff0ab25c1d542934e1a5d9df45da403777dd3c6
dir: /lib/std/chomp.myr/

View raw version
use "hasprefix"

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

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