mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
5a11a46e2d
commit
3619f1ea6a
11 changed files with 121 additions and 119 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue