java - 删除回车时replaceAll不起作用
问题描述
我正在使用此调用从字符串中删除回车符
input = input.replaceAll("[\r\n]", "");
return input;
但是当将此字符串作为输入时:http://localhost:4200/\n\rhome
我得到以下输出:http://localhost:4200/\\n\\rhome
知道为什么吗?我该如何解决这个问题?
解决方案
推荐阅读
- javascript - 当需要数组时,Filter() 方法返回布尔值
- flutter - Flutter - 右溢出
- python - 无法使用 Miniconda 将 Python 从 3.4.5 升级到 3.6。遇到 UnsatisfiableError
- postgresql - 从具有私有和公共 IP 的虚拟机连接到私有 IP 上的 Google Cloud SQL 实例失败
- excel - Excel 根据下拉菜单跳转到特定列/单元格
- python - 熊猫数据框放大
- django - ManyToManyRelation 中的 Django models.CASCADE
- python - Python:字符串连接
- compiler-construction - 我怎样才能使它能够用 LALR(1) 解决
- r - 为什么 XPath 中的“link”比“//link”快?