From 6485051871302b42672b8363b2d0d0af541eb675 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 10 Aug 2024 11:59:09 +0200 Subject: Minor refactoring --- mintages/parser.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'mintages') 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 { -- cgit v1.2.3