summaryrefslogtreecommitdiff
path: root/src/strings/strings.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/strings.go')
-rw-r--r--src/strings/strings.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go
index 1b9df2e75..27d384983 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -225,13 +225,8 @@ func LastIndex(s, sep string) int {
// r, or -1 if rune is not present in s.
func IndexRune(s string, r rune) int {
switch {
- case r < 0x80:
- b := byte(r)
- for i := 0; i < len(s); i++ {
- if s[i] == b {
- return i
- }
- }
+ case r < utf8.RuneSelf:
+ return IndexByte(s, byte(r))
default:
for i, c := range s {
if c == r {