I know this is a common way to ask but I just want to include white space when checking digits number, so I have this string
6031 3100 3440 0189 000
So now I want to check that value if it is contains just only the number
I came up with this solution
String Cardresult = edtCashCard.getText().toString();
if (Cardresult.matches("[0-9]+")){
Toast.makeText(getApplicationContext(), "Good Job the strings are numbers", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(getApplicationContext(), "Error the string contains character", Toast.LENGTH_SHORT).show();
}
But now I know there's white space in the variable and based on the first condition, even though your variable contains numbers but since there's white space it does not count as a number it counts as string, and now I want to consider white space as a number to trigger to the first condition, is there anything that can I do with this? It very helpful me a lot