替換字符串中部分字符串,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標量子查詢的優化案例分析