diff options
author | siddharth <s@ricketyspace.net> | 2021-06-19 11:48:29 -0400 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2021-06-19 11:48:29 -0400 |
commit | 6717e6895546da4739355506abf7000a8d794f51 (patch) | |
tree | 4482db4a8bbb4e1bb469740ac331403a61074fa5 /lib | |
parent | d90053b1bb6620dc999f723d64aadccfbe6e0bbf (diff) |
lib: update AlphaPunchScore
- Use AsciiScores for scores
- Remove isAlphaPunch
Diffstat (limited to 'lib')
-rw-r--r-- | lib/str.go | 21 |
1 files changed, 1 insertions, 20 deletions
@@ -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) |