Sample code for 30+ languages & platforms
Objective-C

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat Objective-C Downloads

Objective-C
#import <NSString.h>
#import <CkoStringBuilder.h>

NSString *s = @"The quick brown fox jumps over the lazy dog";

CkoStringBuilder *sb = [[CkoStringBuilder alloc] init];

[sb Append: s];

//  output: The quick brown fox jumps over the lazy dog
NSLog(@"%@",[sb GetAsString]);

//  Get the string encoded to base64, without changing the contents of sb.
//  output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
NSLog(@"%@",[sb GetEncoded: @"base64" charset: @"utf-8"]);

//  The contents of sb are not changed..
//  output: The quick brown fox jumps over the lazy dog
NSLog(@"%@",[sb GetAsString]);