Sample code for 30+ languages & platforms
Lua

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local s = "The quick brown fox jumps over the lazy dog"

local sb = chilkat.StringBuilder.new()

sb:append(s)

-- output: The quick brown fox jumps over the lazy dog
print(sb:get_as_string())

-- Get the string encoded to base64, without changing the contents of sb.
-- output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
print(sb:get_encoded("base64", "utf-8"))

-- The contents of sb are not changed..
-- output: The quick brown fox jumps over the lazy dog
print(sb:get_as_string())