develog

StringBuilder, replace 본문

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);

    }

}

'Dev > Java' 카테고리의 다른 글

template, callback  (0) 2013.07.17
AsyncHttpClient  (0) 2013.07.11
spring-test-dbunit  (0) 2013.07.09
dbunit jar download  (0) 2013.07.09
Async  (0) 2013.07.09
Comments