aboutsummaryrefslogtreecommitdiff
path: root/src/bytes/bytes.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytes/bytes.go')
-rw-r--r--src/bytes/bytes.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go
index c54e52e4fc..7ecf3b59f6 100644
--- a/src/bytes/bytes.go
+++ b/src/bytes/bytes.go
@@ -112,7 +112,7 @@ func LastIndex(s, sep []byte) int {
case n == 0:
return len(s)
case n == 1:
- return LastIndexByte(s, sep[0])
+ return bytealg.LastIndexByte(s, sep[0])
case n == len(s):
if Equal(s, sep) {
return 0
@@ -144,12 +144,7 @@ func LastIndex(s, sep []byte) int {
// LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s.
func LastIndexByte(s []byte, c byte) int {
- for i := len(s) - 1; i >= 0; i-- {
- if s[i] == c {
- return i
- }
- }
- return -1
+ return bytealg.LastIndexByte(s, c)
}
// IndexRune interprets s as a sequence of UTF-8-encoded code points.