2023 Day 9 Complete!
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user