Sample code for 30+ languages & platforms
React Native

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat React Native Downloads

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

function chilkatExample() {
  const s = 'The quick brown fox jumps over the lazy dog';

  const sb = new StringBuilder();

  sb.append(s);

  // output: The quick brown fox jumps over the lazy dog
  console.log(sb.getAsString());

  // Get the string encoded to base64, without changing the contents of sb.
  // output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
  console.log(sb.getEncoded('base64', 'utf-8'));

  // The contents of sb are not changed..
  // output: The quick brown fox jumps over the lazy dog
  console.log(sb.getAsString());
}