Sample code for 30+ languages & platforms
React Native

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat React Native Downloads

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

function chilkatExample() {
  const sb = new StringBuilder();
  sb.append('abc::def::ghi');

  // Replace the 1st occurrence of a substring with another string.
  let bFound = true;
  try {
    sb.replaceFirst('::', '-');
  } catch {
    bFound = false;
  }

  console.log(`bFound = ${bFound}`);
  console.log(`sb contains: ${sb.getAsString()}`);

  // Output is:
  // bFound = True
  // sb contains: abc-def::ghi
}