Sample code for 30+ languages & platforms
PowerShell

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

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

$sb = New-Object Chilkat.StringBuilder

$sb.Append($s)

# output: The quick brown fox jumps over the lazy dog
$($sb.GetAsString())

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

# The contents of sb are not changed..
# output: The quick brown fox jumps over the lazy dog
$($sb.GetAsString())