iphone - 如何在 iOS 中获取 ISBN 条形码

标签 iphone ios xcode barcode barcode-scanner

我正在做一个关于 ISBN 条形码扫描的项目。我尝试了很多扫描应用程序,但扫描此条形码后:enter image description here

应用程序只返回条码 9780749423490。 但我需要获取的是 ISBN 代码 0749423498,因为它在我图书馆的数据库中。有什么方法可以获取吗?

谁能解释一下这两个代码之间的区别?为什么条形码编号和 ISBN 条形码编号不同?有些书是一样的,有些书又不一样吗?谢谢!

最佳答案

看起来混淆是“ISBN 10”和“ISBN 13”标准之间的区别。

ISBN 机构网站 FAQ说:

"Does the ISBN-13 have any meaning imbedded in the numbers? 
The five parts of an ISBN are as follows:

 1. The current ISBN-13 will be prefixed by "978"
 2. Group or country identifier which identifies a national or geographic grouping of publishers
 3. Publisher identifier which identifies a particular publisher within a group
 4. Title identifier which identifies a particular title or edition of a title
 5. Check digit is the single digit at the end of the ISBN which validates the ISBN"

所以 978 显然只是填充物。之后,接下来的9个数字显然是两个数字相同。这两个数字的最后一位是校验位,在 ISBN 10 和 ISBN 13 中是不同的。参见 this Wikipedia article有关详细信息,但两个公式是:

对于 ISBN 10(最上面的那个),所有数字乘以乘数 10-9-8-7-6-5-4-3-2-1 mod 11 的总和应为 0:

0*10 + 7 *9 + 4*8 + 9*7 + 4*6 + 2*5 + 3*4 + 4*3 + 9*2 + 8*1 % 11 == 0

对于 ISBN 13(底部的)奇数位之和 * 1 加上偶数位之和 * 3 应为 0。这包括前导 978。(这类似于 UPC 代码作为“用户..."提到但与维基百科文章中所述略有不同):

9*1 + 7*3 + 8*1 + 0*3 + 7*1 + 4*3 + 9*1 + 4*3 + 2*1 + 3*3 + 4*1 + 9*3 + 0*1 % 10 == 0

因此您可以从 ISBN 13(底部)代码中获取 ISBN 10 代码(顶部),如下所示:

isbnBaseCode = <9780749423490 from the 4th to 12th characters>

isbn10CheckDigit = 11 - (isbnBaseCode[0]*10 + isbnBaseCode[1]*9 + ... + isbnBaseCode[8]*2) % 11

isbnCode10 = isbnBaseCode + isbn10CheckDigit

关于iphone - 如何在 iOS 中获取 ISBN 条形码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11806298/

相关文章:

iphone - 一个 XCode 项目多个 iPhone 应用程序

iphone - 在其他 View Controller 下面创建一个 View Controller

ios - 在 iOS 7 中如何将用户背景添加到应用程序中作为半透明背景?

ios - 如何停用 itunes 中的应用程序?

objective-c - 使用现有单 View 应用程序代码创建动画的最佳选择是什么?

swift - SpriteKit 场景编辑器

ios - 使用 CFBundleVersion 比较提交的应用程序的不同版本是否正确

iphone - Core Data 对象会取代标准类对象吗?

iphone - 为什么 NSNotification 第三个参数通常是对象 :nil?

ios - 是否可以创建配置文件 "on"iphone?