github.com/goplus/llgo@v0.8.3/cl/_testdata/utf8/in.go (about)

     1  package main
     2  
     3  import (
     4  	"unicode/utf8"
     5  )
     6  
     7  func main() {
     8  	var str = "中abcd"
     9  	for i := 0; i < len(str); {
    10  		r, n := utf8.DecodeRuneInString(str[i:])
    11  		i += n
    12  		println(r)
    13  	}
    14  	println(index(2) == 3)
    15  }
    16  
    17  var array = [...]uint8{
    18  	1, 2, 3, 4, 5, 6, 7, 8,
    19  }
    20  
    21  func index(n int8) uint8 {
    22  	return array[n]
    23  }