diff --git a/camelcase.go b/camelcase.go index b12d111..7d889b5 100644 --- a/camelcase.go +++ b/camelcase.go @@ -55,7 +55,7 @@ func camelCase(src string) (entries []string) { // split into fields based on class of unicode character for _, r := range src { var class int - switch true { + switch { case unicode.IsLower(r): class = 1 case unicode.IsUpper(r): diff --git a/mapper.go b/mapper.go index 244dcb3..d5f04ff 100644 --- a/mapper.go +++ b/mapper.go @@ -383,16 +383,17 @@ func SplitEscaped(s string, sep rune) (out []string) { escaped := false token := "" for _, ch := range s { - if escaped { + switch { + case escaped: token += string(ch) escaped = false - } else if ch == '\\' { + case ch == '\\': escaped = true - } else if ch == sep && !escaped { + case ch == sep && !escaped: out = append(out, token) token = "" escaped = false - } else { + default: token += string(ch) } }