Copy link to clipboard
Copied
Hello, all.
Does anyone know of a CFC that can take a string and return whether that string is a UPC, an EAN, or an ISBN?
I'm working on a site that adds items to a seller's half.com account (for many sellers) and the product ID that is being supplied could be a UPC, an EAN, or an ISBN (both -10 and -13), and I need to be able to tell half.com which the product ID is.Thanks,^_^Copy link to clipboard
Copied
UPC, an EAN, or an ISBN (both -10 and -13)
Have you checked cflib.org? I know they have a function for ISBN at least. Also, what type of UPC?
Copy link to clipboard
Copied
To expand -==cfSearching==-'s suggestion,
For ISBN,
http://cflib.org/udf/IsISBN
For UPC,
http://cflib.org/index.cfm?event=page.udfbyid&udfid=661
Unfortunately there is no library avaiable for EAN (in CFLIB)., but I hope you can follow the ISBN code from where you can build another library for EAN.
Copy link to clipboard
Copied
Unfortunately there is no library avaiable for EAN (in
CFLIB)., but I hope you can follow the ISBN code from where
you can build another library for EAN.
That would be a good addition. But what formats of EAN? There is some overlap between the types you listed. I am not sure you could differentiate between some of them. Not unless the values are formatted. Or perhaps use different check digit calculations.
Copy link to clipboard
Copied
cflib.org (which I love) has a script for ISBN-10 that just checks to see if it is a valid ISBN-10; not much for UPC, there, and nothing for EAN.
Copy link to clipboard
Copied
At a high level, you could probably determine if a string might be UPC-A, ISBN-10 OR EAN/ISBN-13. IIRC, all of the codes are numeric only. So a simple regex, plus a check digit verification could probably tell you that.
http://en.wikipedia.org/wiki/International_Standard_Book_Number
But again, I am not so sure you can definitively differentiate the value type, using just an un-formatted string of numbers. You might check around for other libraries (even if they are not in CF). That would give you an idea if it is feasible and/or if there is something you could adapt.
-Leigh
Copy link to clipboard
Copied
WolfShade,
I came across this webservice named "GetISBNInformation", through which you can perform the ISBN (or) EAN lookups.
As for UPC,
You can make use of this UDF,
http://cflib.org/index.cfm?event=page.udfbyid&udfid=661
HTH
Copy link to clipboard
Copied
@Daverms
Did you mean to post a url for the webservice?
-Leigh
Copy link to clipboard
Copied