Something is not right with your program:
String s;
char[] b = inputString.toCharArray();
b = new char[b.length];
do {
if(!(b[i]>='0')&&(b[i]<='9')&&(b[i]!='.')) {
...
}
} while...
You're creating a char[]
from your inputString
, and then on the next line you assign a whole new empty char[]
in your b
variable. b[i]
will in fact never be equals to 0
, 9
or i
. Did you put that line here by error?
Then for the removing thing, I'd suggest too the use of an ArrayList where you will be able to iterate over it and remove the specific index you want to remove very easily.