In j2me ,i have editfield which takes its input ,in it we can enter 3 digits
when i enter first and third ,leaving 2nd digit empty ,
how to remove empty digit thanks
In j2me ,i have editfield which takes its input ,in it we can enter 3 digits
when i enter first and third ,leaving 2nd digit empty ,
how to remove empty digit thanks
You can create a replaceAll method like this:
public static String replaceAll(String text, String searchString, String replacementString) {
StringBuffer sBuffer = new StringBuffer();
int pos = 0;
while ((pos = text.indexOf(searchString)) != -1) {
sBuffer.append(text.substring(0, pos) + replacementString);
text = text.substring(pos + searchString.length());
}
sBuffer.append(text);
return sBuffer.toString();
}
Then you can call it this way:
text = replaceAll(text, " ", "");