aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/strings.go')
-rw-r--r--src/strings/strings.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go
index 8ce2abfdf8..a98f5d8ff1 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -146,6 +146,11 @@ func LastIndex(s, substr string) int {
return -1
}
+// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
+func IndexByte(s string, c byte) int {
+ return bytealg.IndexByteString(s, c)
+}
+
// IndexRune returns the index of the first instance of the Unicode code point
// r, or -1 if rune is not present in s.
// If r is utf8.RuneError, it returns the first instance of any