Reputation: 8066
When I load the audio name, some include char "[","]" How to convert such string include "[","]" to OBJ-C compatible string?
Welcome any comment Ken
Upvotes: 0
Views: 234
Reputation: 21464
To create a static NSString
, do this:
NSString *stringA = @"a string with some square brackets [ ] ";
If you have a C string, you can create an NSString
using the following methods (depending on whether your string is encoded in ASCII or UTF8:
char *utf8String;
NSString *stringB = [NSString stringWithUTF8String:utf8String];
char *asciiString;
NSString *stringC = [NSString stringWithCString:asciiString encoding: NSASCIIStringEncoding];
Upvotes: 0
Reputation: 61228
An Objective-C string is defined with an @ and quotes. @"["
works fine for me ... Maybe you could clarify your question a bit?
Upvotes: 1