我想在Edit Text中找到\n
然後執行某些操作; 我不想當他使用編輯文本 進入舉例來說,在我的應用程序沒有人給用戶錯誤允許寫這句話 一句話:"Hello \n world"
在編輯文本中查找 n android
我用這個代碼,它的工作對字符,但沒有對於\n
代碼工作:
private boolean findn(String t){
for (int i=0;i<t.length();i++){
if (t.charAt(i)=='\n'){
return true;
}
}
return false;
}
http://stackoverflow.com/questions/2163045/how-to-remove-line-breaks-from-a-file-in-java – ecle