cl/_testlibgo: bytes strings

This commit is contained in:
visualfc
2024-06-26 20:30:00 +08:00
parent e217d39882
commit 8169d8509f
6 changed files with 312 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
package main
import (
"strings"
"unicode"
)
func main() {
var b strings.Builder
b.Write([]byte("Hello "))
b.WriteString("World")
println("len:", b.Len(), "cap:", b.Cap(), "string:", b.String())
f := func(c rune) bool {
return unicode.Is(unicode.Han, c)
}
println(strings.IndexFunc("Hello, 世界", f))
println(strings.IndexFunc("Hello, world", f))
}