diff options
Diffstat (limited to 'flood.go')
-rw-r--r-- | flood.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -4,6 +4,7 @@ import ( "math" "sort" "strings" + "unicode" "unicode/utf8" ) @@ -45,3 +46,13 @@ func commonWord(v []string) int { sort.Sort(sort.Reverse(sort.IntSlice(l))) return l[0] } + +func noSpaceCompare(a, b string) bool { + dropSpaces := func(r rune) rune { + if unicode.IsSpace(r) { + return -1 + } + return r + } + return strings.Map(dropSpaces, a) == strings.Map(dropSpaces, b) +} |