扫描代码中添加了括号

发布于 2024-11-03 07:50:33 字数 50 浏览 0 评论 0原文

当我的条形码扫描仪扫描代码时,它会在开头添加 ],在结尾添加 [。我怎样才能改变这个?

When my barcode scanner scans a code, it adds ] to the beggining and [ to the end. How can I change this?

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

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

发布评论

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

评论(2

未央 2024-11-10 07:50:33

不幸的是,它是条形码扫描仪设置参数,并且因特定条形码读取器而异。您将需要条码扫描仪的文档/SDK。许多条码扫描仪只需扫描设置条码即可设置前导/尾随字符。

Unfortunately, it's a barcode scanner setup parameter and varies by the particular barcode reader. You will need the documentation / SDK for your barcode scanner. Many barcode scanners can setup the leading/trailing character just by scanning a setup barcode.

毁梦 2024-11-10 07:50:33

也许有一件事你可以做,我们可以将其视为我们代码库中的本地管理。

    func removeAllUnusedSpacesAndTabsCharacters(strBarCode: String) -> String {
    var strCode = strBarCode.replacingOccurrences(of: "\r", with: "")
    strCode = strCode.replacingOccurrences(of: " ", with: "")
    strCode = strCode.replacingOccurrences(of: "  ", with: "")
    strCode = strCode.replacingOccurrences(of: "\r\n", with: "")
    strCode = strCode.replacingOccurrences(of: "\t", with: "")
    strCode = strCode.replacingOccurrences(of: "\n", with: "")
    strCode = strCode.replacingOccurrences(of: "^\\s*", with: "")
    strCode = strCode.trimmingCharacters(in: .whitespacesAndNewlines)
    return strCode
}

当条形码扫描并显示在标签或字段上时,在设置之前准备一个函数并输入上面的代码片段。

这将删除 [ 括号。

There may be one thing you can do, we can consider it as a local management in our code base.

    func removeAllUnusedSpacesAndTabsCharacters(strBarCode: String) -> String {
    var strCode = strBarCode.replacingOccurrences(of: "\r", with: "")
    strCode = strCode.replacingOccurrences(of: " ", with: "")
    strCode = strCode.replacingOccurrences(of: "  ", with: "")
    strCode = strCode.replacingOccurrences(of: "\r\n", with: "")
    strCode = strCode.replacingOccurrences(of: "\t", with: "")
    strCode = strCode.replacingOccurrences(of: "\n", with: "")
    strCode = strCode.replacingOccurrences(of: "^\\s*", with: "")
    strCode = strCode.trimmingCharacters(in: .whitespacesAndNewlines)
    return strCode
}

When the barcode scanned and showed on your label or field, before setting on it prepare a function and put the above code snippet.

This will remove the [ brackets.

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