본문 바로가기

블로그/오브젝티브C

NSString to unicode(unichar), unichar to NSString

 //nsstring to unichar

    NSString *str1 = @"";

    unichar uniChar;

    [str1 getCharacters:&uniChar];

    NSLog(@"%zd",uniChar);

    

    //unichar to nsstring

    NSString *str2 = [NSString stringWithCharacters:&uniChar length:1];

    NSLog(@"결과: %@", str2);//r