java需要从字符串中转义“| |”条件
我遇到了需要删除“| |”并从字符串中插入反斜杠的情况
String s = "stack||overflow";
我需要替换,结果字符串应该是“stack\overflow”
我尝试使用replaceAll函数,但没有成功
感谢您的帮助
谢谢, 斯雷坎特
你可以在下面搜索框中键入要查询的问题!
我遇到了需要删除“| |”并从字符串中插入反斜杠的情况
String s = "stack||overflow";
我需要替换,结果字符串应该是“stack\overflow”
我尝试使用replaceAll函数,但没有成功
感谢您的帮助
谢谢, 斯雷坎特
# 1 楼答案
这已在Oracle tutorial部分中将字符和子字符串替换为字符串中描述:
例如: