NSString* str = @"teststring";
NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];
More Related Contents:
- Converting between NSData and base64 strings
- How can I convert my device token (NSData) into an NSString?
- How to change the text of a button to the data of a NSString?
- how to remove " in json string?
- Can’t set cell title’s text
- Constants in Objective-C
- Converting NSString to NSDate (and back again)
- How do I URL encode a string
- Convert UTF-8 encoded NSData to NSString
- Objective-C and Swift URL encoding
- Remove HTML Tags from an NSString on the iPhone
- Converting HEX NSString To NSData
- String replacement in Objective-C
- Converting escaped UTF8 characters back to their original form
- How do I test if a string is empty in Objective-C?
- Objective-C 101 (retain vs assign) NSString
- How do I get word wrap information with the new iOS 7 APIs?
- What is difference between URLWithString and fileURLWithPath of NSURL?
- Found a strange issue. Default value of BOOL is returning TRUE for iOS 10 [closed]
- Bold & Non-Bold Text In A Single UILabel?
- Firebase query – Find item with child that contains string
- UIAlertView addSubview in iOS7
- Xcode not automatically creating bridging header?
- iOS detect if user is on an iPad
- Retrieve all contacts phone numbers in iOS
- Posting video on instagram using hooks
- Programmatically open Maps app in iOS 6
- Swift equivalent to `[NSDictionary initWithObjects: forKeys:]`
- iOS 7 style Blur view
- How to manage cookies with UIWebView in Swift