如何从此字符串中删除%0A: - 这是输入密钥代码,我需要从整个字符串中删除。那怎么能这样呢?
输入: -
“NA%0A%0AJKhell这是测试%0A”
输出: -
NAJKhell这是测试
更新
String Comment = cmment_comment_edtx.getText().toString().trim();
String query = URLEncoder.encode(Comment, "utf-8");
System.out.println("comment edit is "+query);
query.replace("$0A", "");
String query2 = URLEncoder.encode(query, "utf-8");
答案 0 :(得分:5)
尝试
String input = "NA%0A%0AJKhell this is test %0A";
String output = input.replaceAll("$0A","");
答案 1 :(得分:3)
示例:
public class AP {
public static void main(String[] args) {
String text = "NA%0A%0AJKhell this is test %0A";
System.out.println(text.replaceAll("%0A",""));
}
}
输出: NAJKhell这是测试