JavaScript
JavaScript
StringBuilder GetEncoded
Demonstrates the Chilkat StringBuilder GetEncoded method.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat
v11.4.0 or greater.
var s = "The quick brown fox jumps over the lazy dog";
var sb = new CkStringBuilder();
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());