如何从Maatwebsite / Excel的第一行删除号码 请帮我解决这个问题。
editText.addTextChangedListener(new TextWatcher() {
private String current = "";
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
if (!s.toString().equals(current)) {
editText.removeTextChangedListener(this);
Locale local = new Locale("id", "id");
String replaceable = String.format("[Rp,.\\s]",
NumberFormat.getCurrencyInstance().getCurrency()
.getSymbol(local));
String cleanString = s.toString().replaceAll(replaceable,
"");
double parsed;
try {
parsed = Double.parseDouble(cleanString);
} catch (NumberFormatException e) {
parsed = 0.00;
}
NumberFormat formatter = NumberFormat
.getCurrencyInstance(local);
formatter.setMaximumFractionDigits(0);
formatter.setParseIntegerOnly(true);
String formatted = formatter.format((parsed));
String replace = String.format("[Rp\\s]",
NumberFormat.getCurrencyInstance().getCurrency()
.getSymbol(local));
String clean = formatted.replaceAll(replace, "");
current = formatted;
editText.setText(clean);
editText.setSelection(clean.length());
editText.addTextChangedListener(this);
}
}
});