summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/str.go21
1 files changed, 1 insertions, 20 deletions
diff --git a/lib/str.go b/lib/str.go
index ee8667f..8fd6344 100644
--- a/lib/str.go
+++ b/lib/str.go
@@ -89,30 +89,11 @@ func StripSpaceChars(s string) string {
func AlphaPunchScore(bs []byte) int {
s := 0
for i := 0; i < len(bs); i++ {
- if isAlphaPunch(bs[i]) {
- s += 1
- }
+ s += AsciiScores[bs[i]]
}
return s
}
-// Returns true if byte 'c' is a non-numeric character in the English language.
-func isAlphaPunch(c byte) bool {
- switch {
- case 'A' <= c && c <= 'Z':
- return true
- case 'a' <= c && c <= 'z':
- return true
- case c == ' ' || c == '.':
- return true
- case c == ',' || c == '\'':
- return true
- case c == '"':
- return true
- }
- return false
-}
-
func NumToChar(n int64) byte {
if 0 <= n && n <= 9 {
return byte(48 + n)