isHexString returns true if every character in s is a lowercase hex digit (0-9, a-f).
(s string)
| 248 | |
| 249 | // isHexString returns true if every character in s is a lowercase hex digit (0-9, a-f). |
| 250 | func isHexString(s string) bool { |
| 251 | for _, c := range s { |
| 252 | if (c < '0' || c > '9') && (c < 'a' || c > 'f') { |
| 253 | return false |
| 254 | } |
| 255 | } |
| 256 | return len(s) > 0 |
| 257 | } |
| 258 | |
| 259 | // isAlphanumericID returns true if s is 3-8 lowercase alphanumeric chars with at least one digit. |
| 260 | // This avoids false-positives on English words like "readme". |
no outgoing calls
no test coverage detected