cl/_testlibgo: bytes strings
This commit is contained in:
20
cl/_testlibgo/strings/in.go
Normal file
20
cl/_testlibgo/strings/in.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user