解码驾照PDF417或磁条
decode drivers license PDF417 or magnetic strip
我能够从条形码中提取代码,但是当从俄亥俄州驾驶执照中读取磁性脚本时,我似乎无法像 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
文本行内是否有密码加密
我知道这是一个老问题,但也许有人仍然会觉得这个答案有帮助。
看来,至少对于俄亥俄州来说,两个字母的车牌号码前缀是由字母表中的序号表示的 (A=01 .. Z=26)。
所以在样本数据中“;6360231911247481”
“636023”是俄亥俄州的 ANSI Id 前缀和
“19”是第一个字母(“S”)的序数,并且
“11”是第二个字母(“K”)的序数,
“247481”是剩余的数字部分。
所以对于这个例子,完整的 DL 编号是“SK247481”。
请注意,这是根据示例数据确定的,而不是记录的来源,所以 ymmv。
我能够从条形码中提取代码,但是当从俄亥俄州驾驶执照中读取磁性脚本时,我似乎无法像 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
文本行内是否有密码加密
我知道这是一个老问题,但也许有人仍然会觉得这个答案有帮助。
看来,至少对于俄亥俄州来说,两个字母的车牌号码前缀是由字母表中的序号表示的 (A=01 .. Z=26)。
所以在样本数据中“;6360231911247481” “636023”是俄亥俄州的 ANSI Id 前缀和 “19”是第一个字母(“S”)的序数,并且 “11”是第二个字母(“K”)的序数, “247481”是剩余的数字部分。
所以对于这个例子,完整的 DL 编号是“SK247481”。
请注意,这是根据示例数据确定的,而不是记录的来源,所以 ymmv。