I read passport information through a scanner When the scanner reads the passport, the data comes out like this
#PGRPMUSAAAA<<BBB<CCCC<<<<<<<<<<<<<<<<<<<<<<<<<\nM987654321USA7303010M20071519876543V12345678\n
I want to get FULL NAME, LAST NAME ,FIRST NAME, NATION CODE,PASSPORTNUM,SEX,BIRTH respectively
I extracted the name and other data by expressing it like this in the code
var MrzArraySplit = mrz.Substring(0).Split(new[] { "<" }, StringSplitOptions.RemoveEmptyEntries);
Data.FullName = OcrArraySplit[0] + OcrArraySplit[1] + OcrArraySplit[2]; //AAABBBCCCC
Data.LastName = OcrArraySplit[0]; // AAA
Data.FirstName1 = OcrArraySplit[1]; // BBB
Data.FirstName2 = OcrArraySplit[2]; // CCCC
Data.PassportNum = OcrArraySplit[3].Replace("\n",""); // \nM987654321USA7303010M20071519876543V12345678\n
Data.Birth = "";
Data.Sex = "";
Data.NationCode = "";
How should I code to extract the data I want to get?
Second line of MRZ (between \n and \n) contains not only password number, but all information you need (see https://en.wikipedia.org/wiki/Machine-readable_passport for example). Extract parts of string from fixed positions:
etc