shithub: mc

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