Objective-C
Objective-C
Base62 Encoding and Decoding
Demonstrates base62 encoding and decoding.Chilkat Objective-C Downloads
#import <CkoBinData.h>
#import <NSString.h>
#import <CkoStringBuilder.h>
CkoBinData *bd = [[CkoBinData alloc] init];
// Base62 encode.
[bd AppendString: @"hello world" charset: @"utf-8"];
NSString *base62_encoded = [bd GetEncoded: @"base62"];
NSLog(@"%@%@",@"hello world --> ",base62_encoded);
// Output:
// hello world --> AAwf93rvy4aWQVw
// Base62 decode
CkoStringBuilder *sb = [[CkoStringBuilder alloc] init];
[sb DecodeAndAppend: @"AAwf93rvy4aWQVw" encoding: @"base62" charset: @"utf-8"];
NSLog(@"%@%@",@"decoded: ",[sb GetAsString]);
// Output:
// decoded: hello world