September 2017
Intermediate to advanced
466 pages
9h 33m
English
The trickiest part of the code implementation is word counting, which is implemented using regular expressions:
r := regexp.MustCompile("[^\\s]+")
for range r.FindAllString(line, -1) {
numberOfWords++
}
Here, the provided regular expression separates the words of a line based on whitespace characters in order to count them afterwards!
Read now
Unlock full access