Lorsque je charge le nom audio, certains incluent char "[", "]" Comment convertir une telle chaîne en incluant "[", "]" dans une chaîne compatible OBJ-C?caractère spécial dans NSString
Bienvenue tout commentaire Ken
Lorsque je charge le nom audio, certains incluent char "[", "]" Comment convertir une telle chaîne en incluant "[", "]" dans une chaîne compatible OBJ-C?caractère spécial dans NSString
Bienvenue tout commentaire Ken
Une chaîne Objective-C est définie avec un @ et des citations. @"["
fonctionne bien pour moi ... Peut-être pourriez-vous clarifier un peu votre question?
Pour créer un NSString
statique, faites ceci:
NSString *stringA = @"a string with some square brackets [ ] ";
Si vous avez une chaîne C, vous pouvez créer un NSString
en utilisant les méthodes suivantes (selon que votre chaîne est codée en ASCII ou UTF8:
char *utf8String;
NSString *stringB = [NSString stringWithUTF8String:utf8String];
char *asciiString;
NSString *stringC = [NSString stringWithCString:asciiString encoding: NSASCIIStringEncoding];