fixed bug where real numbers crashed app

This commit is contained in:
John O'Keefe 2025-05-06 16:52:18 -04:00
parent 41f592ec45
commit 25a7658328
4 changed files with 62 additions and 0 deletions

46
answer.txt Normal file
View File

@ -0,0 +1,46 @@
UPC
200033148770
200042041350
200042041400
200042064910
200047796200
200059594110
200059660970
200065290180
200065290220
200065290310
200065290340
200065290370
200066707320
200069556670
200072791220
0075849385857
200072791320
200072791380
200072791470
200072950140
200079186270
200079343740
200081451640
200081630310
200106953220
200156488680
200157056340
200168095820
200168979440
200172490020
200177334550
200177780700
200177788230
327582805540
337582889920
357582840140
357582843530
357582850030
477039522210
477039522200
482000077030
482000077040
482000077090
647582802920
647582804700

View File

@ -14,6 +14,7 @@ UPC
2.0006670732e+11
2.0006955667e+11
2.0007279122e+11
0075849385857
2.0007279132e+11
2.0007279138E+11
2.0007279147E+11

10
isNumeric.go Normal file
View File

@ -0,0 +1,10 @@
package main
import (
"regexp"
)
func isNumeric(s string) bool {
match, _ := regexp.MatchString("^[0-9]+$", s)
return match
}

View File

@ -78,6 +78,11 @@ func main() {
continue
}
if isNumeric(upc) == true {
gtins = append(gtins, upc)
continue
}
// Lower case the E
upc = strings.ToLower(upc)
// Split scientific notation at the e+ point