I have the following string with characters, numbers and also extra non-numeric characters. I managed to replace the non-numeric characters. But I am lost with characters and numbers at the end.I am getting this string from the following method. I use this method to remove the non-numeric.
String[] stringArray = string.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("[^ A-Za-z0-9]","").trim().split(",");
results with "I7f253e0", "I6fc2699"
. How can I parse this ?
public static int[] string_to_int_arr(String string){
String[] stringArray = string.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("[^ A-Za-z0-9]","").trim().split(",");
int[] intArray = new int[stringArray.length];
for (int i = 0; i < stringArray.length; i++){
try {
intArray[i] = Integer.parseInt(stringArray[i]);
} catch (NumberFormatException e){
Log.e(TAG,"" + e);
}
}
return intArray;
}