Dev/Java
StringBuilder, replace
냐옴
2013. 7. 11. 16:51
private void replace(StringBuilder sb, String strFrom, String strTo) {
if (sb == null) return;
if (strFrom == null) return;
if (strTo == null) return;
while (sb.indexOf(strFrom) > -1) {
int idxStart = sb.indexOf(strFrom);
sb.replace(idxStart, idxStart + strFrom.length(), strTo);
}
}