web-dev-qa-db-fra.com

Jeter ou convertir un caractère en nstring dans l'objectif-c

Comment puis-je convertir un caractère en nstring dans l'objectif-c?

Pas une chaîne C Null terminée, juste un simple char c = 'a'.

27
Senkwe

Vous pouvez utiliser stringWithFormat:, en passant dans un format de %c Pour représenter un personnage, comme ceci:

char c = 'a';
NSString *s = [NSString stringWithFormat:@"%c", c];
37
BoltClock