aboutsummaryrefslogtreecommitdiff
path: root/src/lib/strings.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-05-04 22:12:13 -0700
committerRob Pike <r@golang.org>2009-05-04 22:12:13 -0700
commit2067b9fb9243bf42e30dd66b50e49652ca935d5a (patch)
tree540f90bfbe2deedff124fbd3e27d114a6b42393a /src/lib/strings.go
parent567a7bf66473b260ae3eb1c6e69be365c8200592 (diff)
downloadgo-2067b9fb9243bf42e30dd66b50e49652ca935d5a.tar.xz
string slicing is efficient so remove base and bounds arguments from RuneCountInString
R=rsc DELTA=6 (1 added, 0 deleted, 5 changed) OCL=28242 CL=28256
Diffstat (limited to 'src/lib/strings.go')
-rw-r--r--src/lib/strings.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/strings.go b/src/lib/strings.go
index 5ce4a8dae3..33adab2499 100644
--- a/src/lib/strings.go
+++ b/src/lib/strings.go
@@ -10,7 +10,7 @@ import "utf8"
// Explode splits s into an array of UTF-8 sequences, one per Unicode character (still strings).
// Invalid UTF-8 sequences become correct encodings of U+FFF8.
func Explode(s string) []string {
- a := make([]string, utf8.RuneCountInString(s, 0, len(s)));
+ a := make([]string, utf8.RuneCountInString(s));
j := 0;
var size, rune int;
for i := 0; i < len(a); i++ {
@@ -24,7 +24,7 @@ func Explode(s string) []string {
// Count counts the number of non-overlapping instances of sep in s.
func Count(s, sep string) int {
if sep == "" {
- return utf8.RuneCountInString(s, 0, len(s))+1
+ return utf8.RuneCountInString(s)+1
}
c := sep[0];
n := 0;