change utf8.FullRuneInString and utf8.DecodeRuneInString

to use single string argument instead of string, index.

R=r
DELTA=136  (9 added, 7 deleted, 120 changed)
OCL=28642
CL=28644
This commit is contained in:
Russ Cox 2009-05-11 14:10:34 -07:00
parent 5a11a46e2d
commit 3619f1ea6a
11 changed files with 121 additions and 119 deletions

View file

@ -11,12 +11,13 @@ import "utf8"
// Invalid UTF-8 sequences become correct encodings of U+FFF8.
func Explode(s string) []string {
a := make([]string, utf8.RuneCountInString(s));
j := 0;
var size, rune int;
for i := 0; i < len(a); i++ {
rune, size = utf8.DecodeRuneInString(s, j);
i := 0;
for len(s) > 0 {
rune, size = utf8.DecodeRuneInString(s);
s = s[size:len(s)];
a[i] = string(rune);
j += size;
i++;
}
return a
}