|
@ -35,31 +35,31 @@ func findtextdigits(line string) []rune { |
|
|
|
|
|
|
|
|
if strings.HasPrefix(line, "one") { |
|
|
if strings.HasPrefix(line, "one") { |
|
|
d = append(d, '1') |
|
|
d = append(d, '1') |
|
|
line = line[3:] |
|
|
line = line[2:] |
|
|
} else if strings.HasPrefix(line, "two") { |
|
|
} else if strings.HasPrefix(line, "two") { |
|
|
d = append(d, '2') |
|
|
d = append(d, '2') |
|
|
line = line[3:] |
|
|
line = line[2:] |
|
|
} else if strings.HasPrefix(line, "three") { |
|
|
} else if strings.HasPrefix(line, "three") { |
|
|
d = append(d, '3') |
|
|
d = append(d, '3') |
|
|
line = line[5:] |
|
|
line = line[4:] |
|
|
} else if strings.HasPrefix(line, "four") { |
|
|
} else if strings.HasPrefix(line, "four") { |
|
|
d = append(d, '4') |
|
|
d = append(d, '4') |
|
|
line = line[4:] |
|
|
line = line[4:] // skip len("four") entirely because no digits start with 'r'
|
|
|
} else if strings.HasPrefix(line, "five") { |
|
|
} else if strings.HasPrefix(line, "five") { |
|
|
d = append(d, '5') |
|
|
d = append(d, '5') |
|
|
line = line[4:] |
|
|
line = line[3:] |
|
|
} else if strings.HasPrefix(line, "six") { |
|
|
} else if strings.HasPrefix(line, "six") { |
|
|
d = append(d, '6') |
|
|
d = append(d, '6') |
|
|
line = line[3:] |
|
|
line = line[3:] // skip len("six") entirely because no digits start with 'x'
|
|
|
} else if strings.HasPrefix(line, "seven") { |
|
|
} else if strings.HasPrefix(line, "seven") { |
|
|
d = append(d, '7') |
|
|
d = append(d, '7') |
|
|
line = line[5:] |
|
|
line = line[4:] |
|
|
} else if strings.HasPrefix(line, "eight") { |
|
|
} else if strings.HasPrefix(line, "eight") { |
|
|
d = append(d, '8') |
|
|
d = append(d, '8') |
|
|
line = line[5:] |
|
|
line = line[4:] |
|
|
} else if strings.HasPrefix(line, "nine") { |
|
|
} else if strings.HasPrefix(line, "nine") { |
|
|
d = append(d, '9') |
|
|
d = append(d, '9') |
|
|
line = line[4:] |
|
|
line = line[3:] |
|
|
} else { |
|
|
} else { |
|
|
line = line[1:] |
|
|
line = line[1:] |
|
|
} |
|
|
} |
|
|