Update dependencies

This commit is contained in:
bluepython508 committed 2025-04-09 01:00:12 +01:00
1 parent f0641ffd6e
commit 5a9cfc022c
882 files changed
+68907 -24178

No files matched your search

Generated Vendored
+24
View File
@@ -265,6 +265,30 @@ func NewReader(m RO) *Reader {
return &Reader{sr: strings.NewReader(m.str())}
}
// Cut works like strings.Cut, but takes and returns ROs.
func Cut(m, sep RO) (before, after RO, found bool) {
if i := Index(m, sep); i >= 0 {
return m.SliceTo(i), m.SliceFrom(i + sep.Len()), true
}
return m, S(""), false
}
// CutPrefix works like strings.CutPrefix, but takes and returns ROs.
func CutPrefix(m, prefix RO) (after RO, found bool) {
if !HasPrefix(m, prefix) {
return m, false
}
return m.SliceFrom(prefix.Len()), true
}
// CutSuffix works like strings.CutSuffix, but takes and returns ROs.
func CutSuffix(m, suffix RO) (before RO, found bool) {
if !HasSuffix(m, suffix) {
return m, false
}
return m.SliceTo(m.Len() - suffix.Len()), true
}
// Reader is like a bytes.Reader or strings.Reader.
type Reader struct {
sr *strings.Reader