mirror of
https://github.com/golang/go
synced 2024-11-25 10:38:00 -07:00
integrate feedback from rsc
R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=26810 CL=26834
This commit is contained in:
parent
a52d6fb73a
commit
5019a8db7f
@ -256,13 +256,13 @@ func EncodeRune(rune int, p []byte) int {
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeRuneToString returns the string corresponding to the UTF-8 encoding of the rune.
|
// EncodeRuneToString returns the UTF-8 encoding of the rune.
|
||||||
func EncodeRuneToString(rune int) string {
|
func EncodeRuneToString(rune int) string {
|
||||||
if rune < _Rune1Max {
|
if rune < _Rune1Max {
|
||||||
return string([1]byte{byte(rune)})
|
return string([1]byte{byte(rune)})
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf[UTFMax] byte;
|
var buf [UTFMax]byte;
|
||||||
size := EncodeRune(rune, buf);
|
size := EncodeRune(rune, buf);
|
||||||
return string(buf[0:size]);
|
return string(buf[0:size]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user