func strings.Cut
63 uses
strings (current package)
strings.go#L1278: func Cut(s, sep string) (before, after string, found bool) {
crypto/x509
oid.go#L147: firstNum, oid, nextComponentExists = strings.Cut(oid, ".")
oid.go#L151: secondNum, oid, nextComponentExists = strings.Cut(oid, ".")
oid.go#L176: strNum, oid, nextComponentExists = strings.Cut(oid, ".")
pem_decrypt.go#L130: mode, hexIV, ok := strings.Cut(dek, ",")
encoding/asn1
common.go#L97: part, str, _ = strings.Cut(str, ",")
encoding/json
tags.go#L18: tag, opt, _ := strings.Cut(tag, ",")
tags.go#L32: name, s, _ = strings.Cut(s, ",")
encoding/xml
typeinfo.go#L118: if ns, t, ok := strings.Cut(tag, " "); ok {
xml.go#L1175: } else if space, local, ok := strings.Cut(s, ":"); !ok || space == "" || local == "" {
go/build
build.go#L1728: line, argstr, ok := strings.Cut(strings.TrimSpace(line[4:]), ":")
build.go#L2023: name, _, _ = strings.Cut(name, ".")
read.go#L586: path, _, ok = strings.Cut(args[1:], "`")
go/build/constraint
vers.go#L69: _, v, _ := strings.Cut(z.Tag, "go1.")
go/doc/comment
markdown.go#L62: line, md, _ = strings.Cut(md, "\n")
parse.go#L595: if _, b, ok = strings.Cut(b, "'"); !ok {
parse.go#L606: if _, b, ok = strings.Cut(b, "."); !ok {
print.go#L219: line, md, _ = strings.Cut(md, "\n")
print.go#L280: line, rest, ok := strings.Cut(s, "\n")
text.go#L100: line, text, _ = strings.Cut(text, "\n")
go/printer
comment.go#L82: line, text, _ = strings.Cut(text, "\n")
printer.go#L553: if p, _, ok := strings.Cut(prefix, "*"); ok {
printer.go#L607: before, _, _ := strings.Cut(last, closing) // closing always present
go/version
version.go#L21: v, _, _ = strings.Cut(v, "-") // strip -bigcorp suffix.
golang.org/x/tools/internal/stdlib
stdlib.go#L78: typename, name, _ = strings.Cut(sym.Name, ".")
stdlib.go#L90: recv, name, _ = strings.Cut(sym.Name, ".")
golang.org/x/tools/internal/versions
versions.go#L52: v, _, _ = strings.Cut(v, "-") // strip -bigcorp suffix.
html/template
attr.go#L146: } else if prefix, short, ok := strings.Cut(name, ":"); ok {
js.go#L460: mimeType, _, _ = strings.Cut(mimeType, ";")
url.go#L48: if protocol, _, ok := strings.Cut(s, ":"); ok && !strings.Contains(protocol, "/") {
internal/sysinfo
cpuinfo_linux.go#L43: key, value, found := strings.Cut(scanner.Text(), ": ")
mime
encodedword.go#L207: charset, text, _ := strings.Cut(word, "?")
encodedword.go#L211: encoding, text, _ := strings.Cut(text, "?")
mediatype.go#L23: if major, sub, ok := strings.Cut(t, "/"); !ok {
mediatype.go#L135: base, _, _ := strings.Cut(v, ";")
mediatype.go#L168: if baseName, _, ok := strings.Cut(key, "*"); ok {
net/http
cookie.go#L78: name, value, found := strings.Cut(s, "=")
cookie.go#L102: name, value, ok := strings.Cut(parts[0], "=")
cookie.go#L126: attr, val, _ := strings.Cut(parts[i], "=")
cookie.go#L345: part, line, _ = strings.Cut(line, ";")
cookie.go#L350: name, val, _ := strings.Cut(part, "=")
fs.go#L1022: start, end, ok := strings.Cut(ra, "-")
request.go#L1004: username, password, ok = strings.Cut(cs, ":")
request.go#L1028: method, rest, ok1 := strings.Cut(line, " ")
request.go#L1029: requestURI, proto, ok2 := strings.Cut(rest, " ")
response.go#L168: proto, status, ok := strings.Cut(line, " ")
response.go#L175: statusCode, _, _ := strings.Cut(resp.Status, " ")
transport.go#L1897: _, text, ok := strings.Cut(resp.Status, " ")
net/url
url.go#L477: u, frag, _ := strings.Cut(rawURL, "#")
url.go#L537: rest, url.RawQuery, _ = strings.Cut(rest, "?")
url.go#L556: if segment, _, _ := strings.Cut(rest, "/"); strings.Contains(segment, ":") {
url.go#L611: username, password, _ := strings.Cut(userinfo, ":")
url.go#L882: if segment, _, _ := strings.Cut(path, "/"); strings.Contains(segment, ":") {
url.go#L973: key, query, _ = strings.Cut(query, "&")
url.go#L981: key, value, _ := strings.Cut(key, "=")
url.go#L1049: elem, remaining, found = strings.Cut(remaining, "/")
os/exec
exec.go#L1311: k, _, ok := strings.Cut(kv, "=")
regexp
regexp.go#L928: before, after, ok := strings.Cut(template, "$")
regexp/syntax
parse.go#L1032: lit, t, _ = strings.Cut(t[2:], `\E`)
runtime/debug
mod.go#L199: line, data, ok = strings.Cut(data, newline)
mod.go#L263: key, rawValue, ok = strings.Cut(kv, "=")
runtime/pprof
proto.go#L697: loStr, hiStr, ok := strings.Cut(string(addr), "-")
text/template
option.go#L55: if key, value, ok := strings.Cut(opt, "="); ok {