Currently in my app I am getting the QR extracted result as
abcd,cbhsdk,shyuiod,hsjsk:,DOJ:22-May-2015,kjlakjdlkajsd,dfkjdsakjds
Expected result: 22-May-2015 into a string My current code to get string DOJ is as shown below **
enter code here
public void handleResult(Result rawResult) {
// Do something with the result here
Log.e("handler", rawResult.getText()); // Prints scan results
Log.e("handler", rawResult.getBarcodeFormat().toString()); // Prints the scan format (qrcode)
// Assigning the required vales from result *************
String[] arrayOfResultString = new String[1];
arrayOfResultString[0] = rawResult.getText();
String[] arrayOfResultStringDOJ = arrayOfResultString[0].split("DOJ:");
if ((arrayOfResultStringPNR.length > 1) && (arrayOfResultStringPNR[1].length() >= 10) )
{
String DOJ= arrayOfResultStringPNR[1].substring(0, 10);
}
** The challenge for this code is DOJ position may vary during different QR scans. Kindly help me with the solution.
FYI : QR code library give result which stored in QR code so here you got above result.
If you need only PNR value then spit string with ",".
So you will get PNR No.:4408321486
Now remove "PNR No.:" from above string.