Java
Chilkat2 Java
StringBuilder GetEncoded
Demonstrates the Chilkat StringBuilder GetEncoded method.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.StringBuilder;
public class ChilkatExample {
public static void main(String[] args) {
String s = "The quick brown fox jumps over the lazy dog";
StringBuilder sb = new StringBuilder();
sb.append(s);
// output: The quick brown fox jumps over the lazy dog
System.out.println(sb.getAsString());
// Get the string encoded to base64, without changing the contents of sb.
// output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
System.out.println(sb.getEncoded("base64", "utf-8"));
// The contents of sb are not changed..
// output: The quick brown fox jumps over the lazy dog
System.out.println(sb.getAsString());
}
}