summaryrefslogtreecommitdiff
path: root/flood.go
diff options
context:
space:
mode:
Diffstat (limited to 'flood.go')
-rw-r--r--flood.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/flood.go b/flood.go
index c741bd6..dd1540f 100644
--- a/flood.go
+++ b/flood.go
@@ -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)
+}