mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
runtime: make stringNext use byteindex only, fix index offset
Use stringIterator.byteindex as the loop index, and remove stringIterator.rangeindex, as "the index of the loop is the starting position of the current rune, measured in bytes". This patch also fixes the current loop index returned by stringNext, using `it.byteindex' before - not after - `length' is added.
This commit is contained in:
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
func testRangeString() {
|
||||
for i, c := range "abcü¢€𐍈°x" {
|
||||
println(i, c)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
testRangeString()
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
0 97
|
||||
1 98
|
||||
2 99
|
||||
3 252
|
||||
5 162
|
||||
7 8364
|
||||
10 66376
|
||||
14 176
|
||||
16 120
|
||||
Reference in New Issue
Block a user