Created
August 29, 2016 18:07
-
-
Save ChrisMoney/9d8636f8572cd57031c43b7225fb6a37 to your computer and use it in GitHub Desktop.
Read track data from card - Return account number and site code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// acct number + site code: %6074=4369371343068064237?;6074=0000000000303942? | |
public static string FormatAcctNumber(string cardNumber, out string siteCode) | |
{ | |
// split data by | |
string[] array = cardNumber.Split(';'); | |
string data = array[1]; | |
string[] dataArray = data.Split('='); | |
siteCode = dataArray[0]; | |
string acctNumber = dataArray[1]; | |
// remove question mark | |
int questionMark = acctNumber.IndexOf('?'); | |
acctNumber = acctNumber.Remove(questionMark, 1); | |
// remove leading 0s | |
acctNumber = acctNumber.TrimStart(new char[] {'0'}); | |
return acctNumber; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment