-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
/**
* 删除文本[删除最后匹配]
*
* @param text
*/
public void removeText(String text) {
if (TextUtils.isEmpty(text)) return;
SpannableStringBuilder builder = new SpannableStringBuilder(getText());
int pos = text.toString().indexOf(text);
if (pos > -1) {
try {
builder = builder.delete(pos, pos + text.length());
setText(builder);
} catch (Exception e) {
}
}
}
按照这个方法的意思
此处int pos = text.toString().indexOf(text);
应该是int pos = builder.toString().indexOf(text);
不知道我理解的对不对.
Metadata
Metadata
Assignees
Labels
No labels