Minor cleanup.

This commit is contained in:
Alec Thomas
2018-06-27 21:13:47 +10:00
parent 1bb0c0b4b2
commit 0bc26a865d
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -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):
+5 -4
View File
@@ -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)
}
}