我需要一个带有固定后缀的EditText.我正在使用TextWatcher捕获onTextChanged事件,但是如果我通过添加后缀再次更改Text,则会导致由无限递归引起的stackoverflow异常.
msgtextview.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
//Doing some other stuff
msgtextview.setText("Changed Text") //This cause infinite recursion
}
}
Run Code Online (Sandbox Code Playgroud)
这是代码.
如何使用最后x个字符对NSString进行子串?右到左.
在python中它只需要一行!
>>> "string"[-4:]
'ring'
Run Code Online (Sandbox Code Playgroud)