作者: 百炼 | 来源:发表于2018-12-30 18:50 被阅读0次

    date[2018-12-30]

    // Package words provides support for counting words.
    package words
    
    import "strings"
    
    // CountWords counts the number of words in the specified
    // string and returns the count.
    func CountWords(text string) (count int) {
        count = len(strings.Fields(text))
        return
    }
    
    func CountWords2(text string) int {
        return len(strings.Fields(text))
    }
    

    相关文章

      网友评论

          本文标题:

          本文链接:https://www.haomeiwen.com/subject/jravlqtx.html