Compare commits

...

3 Commits

Author SHA1 Message Date
25a7658328 fixed bug where real numbers crashed app 2025-05-06 16:52:18 -04:00
41f592ec45 removed/reset answer file 2025-05-06 13:26:58 -04:00
ece15459ed fixed bug where e is capitalized 2025-05-06 13:23:32 -04:00
4 changed files with 92 additions and 28 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,32 +14,33 @@ UPC
2.0006670732e+11
2.0006955667e+11
2.0007279122e+11
0075849385857
2.0007279132e+11
2.0007279138e+11
2.0007279147e+11
2.0007295014e+11
2.0007918627e+11
2.0007934374e+11
2.0008145164e+11
2.0008163031e+11
2.0010695322e+11
2.0015648868e+11
2.0015705634e+11
2.0016809582e+11
2.0016897944e+11
2.0017249002e+11
2.0017733455e+11
2.001777807e+11
2.0017778823e+11
3.2758280554e+11
3.3758288992e+11
3.5758284014e+11
3.5758284353e+11
3.5758285003e+11
4.7703952221e+11
4.770395222e+11
4.8200007703e+11
4.8200007704e+11
4.8200007709e+11
6.4758280292e+11
6.475828047e+11
2.0007279138E+11
2.0007279147E+11
2.0007295014E+11
2.0007918627E+11
2.0007934374E+11
2.0008145164E+11
2.0008163031E+11
2.0010695322E+11
2.0015648868E+11
2.0015705634E+11
2.0016809582E+11
2.0016897944E+11
2.0017249002E+11
2.0017733455E+11
2.001777807E+11
2.0017778823E+11
3.2758280554E+11
3.3758288992E+11
3.5758284014E+11
3.5758284353E+11
3.5758285003E+11
4.7703952221E+11
4.770395222E+11
4.8200007703E+11
4.8200007704E+11
4.8200007709E+11
6.4758280292E+11
6.475828047E+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,13 @@ 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
upcArray := strings.Split(upc, "e+")