c0shea / IdParser

Parses PDF417 AAMVA-compliant driver's licenses and ID cards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PA Licence

jmf8883 opened this issue · comments

Your code would not parse the name element on a PA license correctly. I have attached a sample PA license and the code I used to parse the name.

PA License.txt

case "DAA":
var names = data.Split(',', '$');

if (names.Length == 1)
{
    var namesSpaces = data.Split(' ');
    FirstName = namesSpaces[0].Trim().ReplaceEmptyWithNull();
    if (namesSpaces.Length == 2)
    {
        LastName = namesSpaces[1].Trim().ReplaceEmptyWithNull();
        MiddleName = null;
    }
    else
    {
        LastName = namesSpaces[namesSpaces.Length-1].Trim().ReplaceEmptyWithNull();
        MiddleName = String.Join(" ", namesSpaces.Skip(1).Take(namesSpaces.Length - 2)).ReplaceEmptyWithNull();
    }
                    
}
else
{
    LastName = names.Length > 0 ? names[0].Trim().ReplaceEmptyWithNull() : null;
    FirstName = names.Length > 1 ? names[1].Trim().ReplaceEmptyWithNull() : null;
    MiddleName = names.Length > 2 ? names[2].Trim().ReplaceEmptyWithNull() : null;
}

break;

Thanks! Pennsylvania doesn't follow the AAMVA 2000 standard exactly but I added code in ac1bea3 to accommodate it. It will be in the upcoming v4 release.