aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-04-30 10:16:23 +0300
committerDmitry Vyukov <dvyukov@google.com>2015-04-30 08:33:29 +0000
commitcfb8b18e75faa1d0cec07268825db06679cd3946 (patch)
tree08a750cc165499f220384f531354274f82834c8f /src/strings/strings.go
parent09edc5c6ac60e597a2b4807c018325f220c974ab (diff)
downloadgo-cfb8b18e75faa1d0cec07268825db06679cd3946.tar.xz
strings: use LastIndexByte in LastIndex
Change-Id: I1add1b92f5c2688a99133d90bf9789d770fd9f05 Reviewed-on: https://go-review.googlesource.com/9503 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/strings/strings.go')
-rw-r--r--src/strings/strings.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go
index 7b8a6b536b..567a3c5bfa 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -185,14 +185,7 @@ func LastIndex(s, sep string) int {
case n == 0:
return len(s)
case n == 1:
- // special case worth making fast
- c := sep[0]
- for i := len(s) - 1; i >= 0; i-- {
- if s[i] == c {
- return i
- }
- }
- return -1
+ return LastIndexByte(s, sep[0])
case n == len(s):
if sep == s {
return 0