Sample code for 30+ languages & platforms
React Native

StringBuilder ReplaceWord

Demonstrates the ReplaceWord method.

Chilkat React Native Downloads

React Native
import { StringBuilder } from '@chilkat/react-native'

function chilkatExample() {
  const sb = new StringBuilder();
  sb.append('forest, lumber, lumberjack, jack, timberland');

  // The ReplaceWord method replaces word occurances.

  // For example:
  let numReplacements = sb.replaceWord('lumber', 'timber');
  numReplacements = sb.replaceWord('jack', 'joe');

  // The string content is now:
  // forest, timber, lumberjack, joe, timberland
  console.log(sb.getAsString());
}