handled words in files
This commit is contained in:
parent
f973ce2c45
commit
5a0aa7bcdb
11
main.go
11
main.go
@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -41,6 +42,9 @@ func main() {
|
||||
|
||||
var gtins []string
|
||||
|
||||
regex, err := regexp.Compile("[^0-9]")
|
||||
Error(err)
|
||||
|
||||
for _, upc := range upcs {
|
||||
|
||||
upcLength := len(upc)
|
||||
@ -57,6 +61,13 @@ func main() {
|
||||
evenNumber := 0
|
||||
var remainder int
|
||||
|
||||
checkForNonNumber := regex.MatchString(upc)
|
||||
|
||||
if checkForNonNumber {
|
||||
gtins = append(gtins, upc)
|
||||
continue
|
||||
}
|
||||
|
||||
if upcLength < 8 {
|
||||
gtins = append(gtins, "Cannot process upcs less than 8 digits")
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user