社区
Web 开发
帖子详情
replaceAll(String regex, String replacement) 怎么用?
csdn1111
2004-09-17 03:33:38
String s = "http://www.sohu.com/news/a.htm",s1="a.htm" ;
我想把s中的全部 s1删除
replaceAll(String regex, String replacement) 怎么用?
...全文
221
2
打赏
收藏
replaceAll(String regex, String replacement) 怎么用?
String s = "http://www.sohu.com/news/a.htm",s1="a.htm" ; 我想把s中的全部 s1删除 replaceAll(String regex, String replacement) 怎么用?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
micker
2004-09-17
打赏
举报
回复
替换全部子串啊:
String str="azmbczmdefzmgh";
str=str.replaceAll("zm","100000");
System.out.print(str);
结果:
---->
a100000bc100000def100000gh
redlaputa
2004-09-17
打赏
举报
回复
s=s.replaceAll(s1,"");
String
的
replace
All
(
String
regex
,
String
replace
ment
)
博客围绕Java开发语言进行测试,介绍了
replace
ment
参数$1代表
regex
里第一个捕获性分组捕获到的内容,即
regex
中小括号()中的内容,还举例说明指path中只留下特定匹配括号中的字符串。
无涯教程-Java -
String
replace
All
(
String
regex
,
String
replace
ment
函数
本文介绍了Java中的
String
类
replace
All
()方法,用于使用给定的字符串替换所有符合正则表达式的子串,通过实例展示了如何在WelcometoLearnfk.com中替换Learnfk为AMROOD,
replace
All
(
String
regex
,
String
replace
ment
)
本文介绍使用Java进行字符串正则替换的方法,特别是如何正确转义特殊字符如方括号[],并提供代码示例对比正确的转义方式与错误的方式。
String
.
replace
All
(
String
regex
,
String
replace
ment
) 方法的使用
本文介绍了在使用Java
String
.
replace
All
方法时遇到含有特殊字符'/'或'$'导致的IllegalArgu
ment
Exception异常问题,并提供了解决方案,即利用Matcher.quote
Replace
ment
进行转义。
*
String
类的public
String
replace
All
(
String
regex
,
String
replace
ment
)
本文介绍了一个简单的Java程序示例,演示如何利用
String
类的
replace
All
方法去除字符串中的数字。通过设置正则表达式,该方法可以匹配并替换指定的字符模式。
Web 开发
81,111
社区成员
341,723
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章