2023 Day 9 Complete!

This commit is contained in:
2023-12-09 09:41:02 -06:00
parent 41f62cb4d7
commit 83ddf1b040
4 changed files with 315 additions and 2 deletions

View File

@@ -153,12 +153,12 @@ func Atof(i string) float64 {
return ret
}
// Atoi goes through i and removes and characters that aren't numeric
// Atoi goes through i and removes and characters that aren't numeric (or -)
// Then runs it through the normal Atoi
func Atoi(i string) int {
var wrk string
for _, bt := range i {
if bt >= '0' && bt <= '9' {
if bt == '-' || (bt >= '0' && bt <= '9') {
wrk = fmt.Sprintf("%s%s", wrk, string(bt))
}
}