blob: 7eb90173c1b139b5fbc426b7c58ba6764601f131 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package main
func testRangeString() {
for i, c := range "abcü¢€𐍈°x" {
println(i, c)
}
}
func testStringToRunes() {
var s = "abcü¢€𐍈°x"
for i, c := range []rune(s) {
println(i, c)
}
}
func testRunesToString(r []rune) {
println("string from runes:", string(r))
}
type myString string
func main() {
testRangeString()
testStringToRunes()
testRunesToString([]rune{97, 98, 99, 252, 162, 8364, 66376, 176, 120})
var _ = len([]byte(myString("foobar"))) // issue 1246
}
|