shithub: mc

ref: 3450935eec9aa87ac23f8b6524a2c9a873105041
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
	;;
}