Si necesitas un método que realice un reemplazado de una cadena por otra utiliza el siguiente
/**
* Metodo que reemplaza cadenas en un stringbuilder
*
* @param builder
* @param from
* @param to
*/
private 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);
}
}
No hay comentarios:
Publicar un comentario