blob: 333d1428a7cfa55a7a6070befb8cbac1b3d8f450 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
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
;;
}
|