diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-10 11:59:09 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-10 11:59:09 +0200 |
commit | 6485051871302b42672b8363b2d0d0af541eb675 (patch) | |
tree | 0d21d0fef3ed5a7318c170db0748f8028bb4f688 | |
parent | 9d02dc16a8a0fc420fad36ed4c61bfcc3ea1518c (diff) |
Minor refactoring
-rw-r--r-- | mintages/parser.go | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/mintages/parser.go b/mintages/parser.go index e352b20..e5a3efc 100644 --- a/mintages/parser.go +++ b/mintages/parser.go @@ -171,12 +171,10 @@ func isNumeric(s string, dot bool) bool { for _, ch := range s { switch ch { case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - case '.': - if !dot { + default: + if ch != '.' || !dot { return false } - default: - return false } } return true @@ -184,13 +182,8 @@ func isNumeric(s string, dot bool) bool { func isLabel(s string) bool { n := len(s) - switch { - case len(s) > 2 && s[n-1] == ':' && s[n-2] == '*', - len(s) > 1 && s[n-1] == ':': - return true - default: - return false - } + return (n > 2 && s[n-1] == ':' && s[n-2] == '*') || + (n > 1 && s[n-1] == ':') } func atoiWithDots(s string) int { |