We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61e4398 commit 4bf2e56Copy full SHA for 4bf2e56
internal/testhelper/testhelper.go
@@ -8,7 +8,13 @@ package testhelper
8
// IsHex returns true if the string contains only hexadecimal characters.
9
func IsHex(str string) bool {
10
for _, rune := range str {
11
- if !((rune >= '0' && rune <= '9') || (rune >= 'a' && rune <= 'f') || (rune >= 'A' && rune <= 'F')) {
+ var (
12
+ isDigit = rune >= '0' && rune <= '9'
13
+ isLowerHex = rune >= 'a' && rune <= 'f'
14
+ isUpperHex = rune >= 'A' && rune <= 'F'
15
+ )
16
+
17
+ if !isDigit && !isLowerHex && !isUpperHex {
18
return false
19
}
20
0 commit comments