public void replace(StringBuilder builder, String from, String to)

{

   int index = builder.indexOf(from);

   while (index != -1)

   {

       builder.replace(index, index + from.length(), to);

       index += to.length(); // Move to the end of the replacement

       index = builder.indexOf(from, index);

   }

}


출처: http://stackoverflow.com/questions/3472663/replace-all-occurences-of-a-string-using-stringbuilder

'Java' 카테고리의 다른 글

사이트 긁어오기  (0) 2015.08.19
mail 발송  (0) 2015.08.18
mybatis의 insert후 sequence 가져오기  (0) 2014.08.21
MS-SQL JDBC 추가하기.  (0) 2014.07.28
MIME 타입 알아내는 방법  (0) 2013.10.02

+ Recent posts