compiler,runtime: implement []rune to string conversion

This is used by a few packages in the standard library, at least
compress/gzip and regexp/syntax.
This commit is contained in:
Ayke van Laethem
2019-08-11 14:35:34 +02:00
committed by Ron Evans
parent fea56d4164
commit fd3309afa8
4 changed files with 33 additions and 1 deletions
+6 -1
View File
@@ -8,12 +8,17 @@ func testRangeString() {
func testStringToRunes() {
var s = "abcü¢€𐍈°x"
for i,c := range []rune(s) {
for i, c := range []rune(s) {
println(i, c)
}
}
func testRunesToString(r []rune) {
println("string from runes:", string(r))
}
func main() {
testRangeString()
testStringToRunes()
testRunesToString([]rune{97, 98, 99, 252, 162, 8364, 66376, 176, 120})
}