是否有任何算法可以解析或解码使用 Zxing 从条码扫描仪获得的字符串结果?

发布于 2024-12-28 08:54:33 字数 345 浏览 2 评论 0原文

是否有任何算法可以解析或解码使用 Zxing 从条码扫描仪获得的字符串结果?

我想从扫描结果中提取批号或序列号。有没有标准的算法可以做到这一点?

我目前正在使用,

    String lotNumber=scanResults.substring(24,26);  
if (lotNumber.equalsIgnoreCase("10")){  
             System.out.println("Lot numberrrrrrrrrrr " + a.substring(26,a.length()));  
         }  

谢谢
斯内哈

Is there any algorithm which can parse or decode the String results obtained from BarCode Scanner using Zxing?

I want to extract Lot number or serial number from the scanned result. Is there any standard algorithm to do so?

I currently use,

    String lotNumber=scanResults.substring(24,26);  
if (lotNumber.equalsIgnoreCase("10")){  
             System.out.println("Lot numberrrrrrrrrrr " + a.substring(26,a.length()));  
         }  

Thanks
Sneha

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝颜夕 2025-01-04 08:54:34

不,Java 或任何语言都没有魔法可以告诉您生成条形码的数据是什么。您应该了解数据并了解其内容类型(json、xml 等),然后使用解析器。或者,如果它不符合定义的标准(任何随机字符串),则按照您正在做的事情进行。

no there is no magic in java or any language which can tell you what is that data for which that bar code was generated. You should know the data and should know its content type (json, xml etc) and then use the parser. Or if its not as per the defined standards (any random string) than do as what you are doing.

人生戏 2025-01-04 08:54:33

查看 ResultParser 类。它会尝试将结果字符串解析为更有意义的内容。例如“mailto:[email protected]”将返回为 EmailParsedResult,让您知道这是一个电子邮件地址并解析出地址给你。

我不确定这个批号是什么——它并不为人所知,因此没有在您的系统之外实现。但是,是的,您已经可以在项目中找到很多此类逻辑,您也许可以重用和修改它们。

Look at the class ResultParser. It will try to parse the result string as something more meaningful. For example "mailto:[email protected]" would come back as EmailParsedResult, letting you know it's an email address and parsing out the address for you.

I am not sure what this lot number is -- it's not well-known and so not implemented outside your system. But yes you can find a lot of this kind of logic in the project already, which you can perhaps reuse and modify.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文