summaryrefslogtreecommitdiffstats
path: root/lib/str.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/str.go')
-rw-r--r--lib/str.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/str.go b/lib/str.go
index 7129136..e4df4b4 100644
--- a/lib/str.go
+++ b/lib/str.go
@@ -29,6 +29,16 @@ func stripSpaceChars(s string) string {
return ss
}
+func AlphaScore(bs []byte) int {
+ s := 0
+ for i := 0; i < len(bs); i++ {
+ if isAlpha(bs[i]) {
+ s += 1
+ }
+ }
+ return s
+}
+
func isAlpha(c byte) bool {
switch {
case 'A' <= c && c <= 'Z':