0

我能够从条形码中提取代码,但是当从 OHIO 驾驶执照中读取磁性脚本时,我似乎无法像 PDF417 那样获得以许可证号为前缀的两个字母代码。

Private Sub ScannDLButton_Click(sender As Object, e As EventArgs) Handles ScanDLButton.Click
        Try


            Dim strInputBox As String = InputBox("Please Swipe/Scan Customer's Driver's License", "Driver's License")

            Dim strLastName As String
            Dim strFirstName As String
            Dim strMiddleName As String
            Dim strDOB As String
            Dim strStreet As String
            Dim strCity As String
            Dim strState As String
            Dim strZIP As String
            Dim strDL As String
            Dim strCountry As String

这确定它是否是磁条

            If strInputBox.Contains("%") Then

                Dim CaretPresent As Boolean = False
                Dim EqualPresent As Boolean = False
                CaretPresent = strInputBox.Contains("^")
                EqualPresent = strInputBox.Contains("=")

                If CaretPresent Then 'track one
                    Dim CardData As String() = strInputBox.Split("^"c)
                    strState = CardData(0).Substring(1, 2)
                    strCity = CardData(0).Substring(3, CardData(0).Length - 3)
                    Dim strname As String() = CardData(1).Split("$"c)
                    strLastName = strname(0)
                    strFirstName = strname(1)
                    strMiddleName = strname(2)
                    strStreet = CardData(2)
                    Dim strzipcode As String() = CardData(3).Split("+"c)
                    strZIP = strzipcode(1).Substring(2, 5)

                End If

                If EqualPresent Then ' track two
                    Dim CardData As String() = strInputBox.Split("="c)
                    strDOB = CardData(1).Substring(6, 6)

                End If

这确定用户是否扫描了许可证背面的条形码

            ElseIf strInputBox.Contains("ANSI") Then

                Dim separatingStrings As String() = {"ANSI", "DBA", "DCS", "DAC", "DAD", "DBD", "DBB", "DBC", "DAY", "DAU", "DAG", "DAI", "DAJ", "DAK", "DAQ", "DCF", "DCG", "DDE", "DDF", "DDG", "DAZ", "DCI", "DCJ", "DCU", "DCE", "DDA", "DDB", "DAW", "DDK", "ZOZ", "ZOE"}
                Dim text As String = strInputBox
                Dim words As String() = text.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries)
                Dim i As Integer = 0

                For Each word In words
                    _log.Info("Looking at code: " & separatingStrings(i).ToString)
                    _log.Info("Parsing field: " & word.ToString.Trim)
                    strLastName = IIf(separatingStrings(i) = "DCS", word.ToString.Trim, strLastName)
                    strFirstName = IIf(separatingStrings(i) = "DAC", word.ToString.Trim, strFirstName)
                    strMiddleName = IIf(separatingStrings(i) = "DAD", word.ToString.Trim, strMiddleName)
                    strDOB = IIf(separatingStrings(i) = "DBB", word.ToString.Trim, strDOB)
                    strStreet = IIf(separatingStrings(i) = "DAG", word.ToString.Trim, strStreet)
                    strCity = IIf(separatingStrings(i) = "DAI", word.ToString.Trim, strCity)
                    strState = IIf(separatingStrings(i) = "DAJ", word.ToString.Trim, strState)
                    strZIP = IIf(separatingStrings(i) = "DAK", word.ToString.Trim, strZIP)
                    strDL = IIf(separatingStrings(i) = "DAQ", word.ToString.Trim, strDL)
                    strCountry = IIf(separatingStrings(i) = "DCG", word.ToString.Trim, strCountry)
                    i += 1
                Next

            Else
                MessageBox.Show("Incorrect format, contact us with this type of ID", "Scan Driver's License", MessageBoxButtons.OK, MessageBoxIcon.Stop)
                Return
            End If

文本行中是否有代码加密代码。

4

1 回答 1

0

我知道这是一个老问题,但也许有人仍然会觉得这个答案很有帮助。

至少对于俄亥俄州来说,两个字母的许可证号前缀似乎由字母表的序数表示(A=01 .. Z=26)。

因此,在示例数据“;6360231911247481”中,“636023”是俄亥俄州的 ANSI Id 前缀,“19”是第一个字母的序号(“S”),“11”是第二个字母的序号(“K”) , "247481" 是剩余的数字部分。

所以对于这个例子,完整的 DL 编号是“SK247481”。

请注意,这是根据样本数据确定的,而不是记录在案的来源,所以 ymmv。

于 2021-11-05T14:23:00.870 回答