1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

feat: add WordCount

This commit is contained in:
dudaodong
2023-02-21 14:27:00 +08:00
parent ed98ad53ec
commit ec740e442c
3 changed files with 73 additions and 0 deletions

View File

@@ -413,3 +413,28 @@ func ExampleSplitWords() {
// []
// []
}
func ExampleWordCount() {
result1 := WordCount("a word")
result2 := WordCount("I'am a programmer")
result3 := WordCount("Bonjour, je suis programmeur")
result4 := WordCount("a -b-c' 'd'e")
result5 := WordCount("你好,我是一名码农")
result6 := WordCount("こんにちは,私はプログラマーです")
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
fmt.Println(result4)
fmt.Println(result5)
fmt.Println(result6)
// Output:
// 2
// 3
// 4
// 3
// 0
// 0
}