mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:06:41 +08:00
Update word_letter_count.go
This commit is contained in:
@@ -31,7 +31,6 @@ func main() {
|
|||||||
|
|
||||||
func Counters(input string) {
|
func Counters(input string) {
|
||||||
nrchars += len(input) - 2 // -2 for \r\n
|
nrchars += len(input) - 2 // -2 for \r\n
|
||||||
// count number of spaces, nr of words is +1
|
nrwords += len(strings.Fields(input))
|
||||||
nrwords += len(strings.Split(strings.Trim(input, " \n")," "))
|
|
||||||
nrlines++
|
nrlines++
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user