shithub: mc

ref: 779a3ef073261c6919ec2a65545435a35a3f5b6f
dir: /libstd/hassuffix.myr/

View raw version
use "cmp.use"
pkg std =
	const hassuffix	: (s : byte[:], suff : byte[:] -> bool)
;;

const hassuffix = {s, suff
	var tail

	if suff.len >= s.len
		tail = s[s.len - suff.len:]
		match strncmp(tail, suff, suff.len)
		| `Equal:       -> true
		| _:            -> false
		;;
	;;
}