赞
踩
No. | 方法名称 | 类型 | 描述 |
1 | public String replaceAll(String regex,String replasement) | 普通 | 用新的内容替换全部旧内容 |
2 | public String replaceFirst(String regex,String replacement) | 普通 | 替换首个满足条件的内容 |
- public class Demo {
- public static void main(String[] args) {
- String str = "helloworld";
- String strA = str.replaceAll("l", "@");
- String strB = str.replaceFirst("l", "*");
- System.out.println(strA);
- System.out.println(strB);
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。