Java
StringBuilder replaceAll
자바초보자
2016. 1. 8. 16:00
728x90
StringBuilder replaceAll은 지원하지 않아 별도로 제작해야함.
public static void replaceAll(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);
}
}
728x90