Sample code for 30+ languages & platforms
React Native Requires Chilkat v11.2.0+

Base62 Encoding and Decoding

Demonstrates base62 encoding and decoding.

Chilkat React Native Downloads

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

function chilkatExample() {
  const bd = new BinData();

  // Base62 encode.
  bd.appendString('hello world', 'utf-8');
  const base62Encoded = bd.getEncoded('base62');
  console.log(`hello world --> ${base62Encoded}`);

  // Output: 
  // hello world --> AAwf93rvy4aWQVw

  // Base62 decode
  const sb = new StringBuilder();
  sb.decodeAndAppend('AAwf93rvy4aWQVw', 'base62', 'utf-8');
  console.log(`decoded: ${sb.getAsString()}`);

  // Output:
  // decoded: hello world
}