fix break at double quote

This commit is contained in:
Özgür Kesim 2015-07-28 10:25:44 +02:00
parent d40e1cab7c
commit f5b5291777

10
dict.go
View File

@ -42,17 +42,19 @@ func main() {
if strings.HasPrefix(line, VAR1) { if strings.HasPrefix(line, VAR1) {
line = strings.TrimPrefix(line, VAR1) line = strings.TrimPrefix(line, VAR1)
line = strings.TrimSuffix(line, SUFF) line = strings.TrimSuffix(line, SUFF)
left = strings.Split(line, ",") left = strings.Split(line, `","`)
} else if strings.HasPrefix(line, VAR2) { } else if strings.HasPrefix(line, VAR2) {
line = strings.TrimPrefix(line, VAR2) line = strings.TrimPrefix(line, VAR2)
line = strings.TrimSuffix(line, SUFF) line = strings.TrimSuffix(line, SUFF)
right = strings.Split(line, ",") right = strings.Split(line, `","`)
break break
} }
} }
if len(left) != len(right) { if len(left) != len(right) {
println("error: arrays of different length") println("error: arrays of different length")
fmt.Println(strings.Join(left, "\n"), len(left))
fmt.Println(strings.Join(right, "\n"), len(right))
return return
} }
@ -69,8 +71,8 @@ func main() {
} }
for i, _ := range right { for i, _ := range right {
a := strings.Trim(right[i], `"`) a := strings.Trim(right[i], `"`)
b := strings.Trim(left[i], `"`) b := strings.Trim(left[i], `"`)
if a == "" { if a == "" {
continue continue
} }