OnTrac 追踪号码格式和校验和
我正在开发一个运输 跟踪号码 库,并希望添加对 OnTrac。
根据一些样本编号(例如C10999911320231
、C10999606576777
、C11001105367744
),格式似乎是后面跟着C
由 14 位数字组成,其中第一个数字始终是 1
。还有其他格式吗?
似乎还有一个校验和,因为 Google 只能识别某些变体(例如,C10999911320231
有效,但 C10999911320232
无效)。我尝试了各种算法但无法解决。校验和是如何计算的?
I'm working on a shipping tracking number library and would like to add support for OnTrac.
Based on some sample numbers (e.g. C10999911320231
, C10999606576777
, C11001105367744
), the format seems to be a C
followed by 14 digits, where the first digit is always a 1
. Are there other formats?
There also appears to be a checksum, as Google only recognizes certain variations (e.g. C10999911320231
works, but C10999911320232
does not). I tried various algorithms but couldn't work it out. How is the checksum calculated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
跟踪号码是
C
后跟 14 位数字,其中最后一位数字是校验位。校验位计算与 UPS 相同,包括转换C
到4
。感谢 OnTrac 的 Danielle 提供此信息。A tracking number is a
C
followed by 14 digits, where the last digit is the check-digit. The check-digit calculation is identical to UPS, including converting theC
to a4
. Thanks to Danielle at OnTrac for providing this information.现在,OnTrac 追踪号码也可能以
D
开头。为了计算校验位,在计算校验位之前需要将D
替换为5
。请参阅此处和此处获取计算校验位的示例代码。
Now it's also possible that an OnTrac tracking number starts with
D
. To calculate the check digit,D
needs to be replaced with a5
before calculating the check digit.See here and here for sample code to calculate the check digit.