Objective-C
Objective-C
Example: Crypt2.EncodeString method
Demonstrates how to call the EncodeString method.Chilkat Objective-C Downloads
#import <CkoCrypt2.h>
#import <NSString.h>
CkoCrypt2 *crypt = [[CkoCrypt2 alloc] init];
NSString *s = @"Hello World";
NSLog(@"%@",[crypt EncodeString: s charset: @"utf-8" encoding: @"hex"]);
// Output: 48656C6C6F20576F726C64
NSLog(@"%@",[crypt EncodeString: s charset: @"utf-16" encoding: @"hex"]);
// Output: 480065006C006C006F00200057006F0072006C006400
NSLog(@"%@",[crypt EncodeString: s charset: @"utf-8" encoding: @"base64"]);
// Output: SGVsbG8gV29ybGQ=
s = @"électricité";
NSLog(@"%@",[crypt EncodeString: s charset: @"utf-8" encoding: @"hex"]);
// Output: C3A96C6563747269636974C3A9
NSLog(@"%@",[crypt EncodeString: s charset: @"windows-1252" encoding: @"hex"]);
// Output: E96C6563747269636974E9
NSLog(@"%@",[crypt EncodeString: s charset: @"windows-1252" encoding: @"hex_lower"]);
// Output: e96c6563747269636974e9
NSLog(@"%@",[crypt EncodeString: s charset: @"utf-8" encoding: @"url"]);
// Output: %C3%A9lectricit%C3%A9