docstore/pkg/store/helper.go
2019-09-09 08:27:51 +02:00

16 lines
379 B
Go

// Copyright (C) 2019 Marius Schellenberger
package store
// Parts taken from strings.TrimPrefix
func hasTrimPrefix(s, prefix string) (string, bool) {
if len(s) >= len(prefix) && s[0:len(prefix)] == prefix {
return s[len(prefix):], true
}
return s, false
}
// Parts taken from bytes.TrimPrefix
func trimPrefix(b, prefix []byte) string {
return string(b[len(prefix):])
}