Java
Chilkat2 Java
StringBuilder ReplaceWord
Demonstrates the ReplaceWord method.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.StringBuilder;
public class ChilkatExample {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
sb.append("forest, lumber, lumberjack, jack, timberland");
// The ReplaceWord method replaces word occurances.
// For example:
int numReplacements = sb.replaceWord("lumber", "timber");
numReplacements = sb.replaceWord("jack", "joe");
// The string content is now:
// forest, timber, lumberjack, joe, timberland
System.out.println(sb.getAsString());
}
}