Debian Codegraph @

gopls/internal/util/morestrings/strings.go

raw symbols SCIP
1 // Copyright 2025 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package morestrings
6
7 import "strings"
8
9 // CutLast is the "last" analogue of [strings.Cut].
10 func CutLast(s, sep string) (before, after string, ok bool) {
11 if i := strings.LastIndex(s, sep); i >= 0 {
12 return s[:i], s[i+len(sep):], true
13 }
14 return s, "", false
15 }