224
技术社区[云栖]
替换字符串中部分字符串,java
public String replace(String from, String to, String source)
{
if (source == null || from == null || to == null)
return null;
StringBuffer bf = new StringBuffer("");
int index = -1;
while ((index = source.indexOf(from)) != -1)
{
bf.append(source.substring(0, index) + to);
source = source.substring(index + from.length());
index = source.indexOf(from);
}
bf.append(source);
return bf.toString();
}
https://slddyb.blog.51cto.com/2294765/409676
最后更新:2017-04-02 16:47:54
上一篇:
log4j的日志级别
下一篇:
自定义ContentProvider 实例演示
【Opencv】多轮廓拟合
SpringBoot开发案例之mail中文附件乱码
Newell Teapot, Cup and Spoon
Android提高篇之TabHost结合ViewFlipper实现tab滑动翻页特效
Blockchain and its Impact on Different Sectors
Centos 7 中文乱码
Memcached缓存大数据时对服务器内存、CPU的影响及其对硬件的配置需求
asp.net2.0中App_GlobalResources的使用
谷歌领头、大牛联合强推的ML可交互期刊平台Distill:解析其意义与质疑
性能为王:SQL标量子查询的优化案例分析