shithub: mc

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