Objective-C4 [iOS. Objective-C] NSString null ์ฒดํฌ / NSLog, printf ๋ก ์ถ๋ ฅ ์๋ ์์ ์์ ๋ ๊ฐ์ง๋ฅผ ์ ๋ฆฌํ๋ค. 1. NSString ์ ๊ฐ์ด null ์ธ ๊ฒฝ์ฐ๋ฅผ ์ฒดํฌ. nsStr ์ด๋ผ๋ ๋ณ์์ ์๋ฃํ์ด null ์ธ์ง ํน์ nsStr ์ ๊ธธ์ด๊ฐ 0 ์ธ์ง ์ฒดํฌํ๋ค. 2. NSString ์๋ฃํ์ ๋ณ์ nsStr ์ NSLog ์ printf๋ก ์ถ๋ ฅํ๋ค. NSString *nsStr = nil; nsStr = @"This Vlaue is not null";// ์ด ๋ผ์ธ์ด ์์ด์ง๋ฉด else ๋ก ๋ถ๊ธฐ๋๋ค. if (nsStr == (id)[NSNull null] || nsStr.length == 0 ) { NSLog(@"This Value is null\n"); printf("This Value is null\n"); } else { NSLog(@"%@\n", nsStr); printf(.. 2021. 12. 21. [iOS] Objective-C NSString -> char* ๊ณผ char* -> NSString // char* -> NSString char szText[] = "hello World"; NSString* nsStr = [NSString stringWithUTF8String: szText]; // NSString -> char* NSString* nsStr = @"hello World"; char* strTmp = (char*)[nsStr UTF8String]; // NSString -> unsigend char* NSString* nsStr = @"hello World"; unsigned char* strTmp = (unsigned char*)[nsStr UTF8String]; // NSString ๊ธธ์ด ๊ตฌํ๊ธฐ NSString* nsStr2 = @"check length!"; int nLengt.. 2021. 10. 21. [iOS] Objective-C NSString์ ๊ฐ์ null ์ฒดํฌํ๋ ๋ฐฉ๋ฒ NSString *nsStr = @"Hello World"; if ([nsStr isEqual: [NSNull null]]) printf("null"); else printf("not null"); https://stackoverflow.com/questions/19546920/how-to-check-nsstring-is-null-or-not how to Check NSString is null or not I want to check weather a NSString is null or not. Im assigning from an JSON array. After assigning that string value is . Now I want to check this string is null or no.. 2021. 10. 13. [iOS] Objective-C NSMutableDictionary ๋ฅผ json ํํ๋ก ๋ณํ iOS (Objective-C) ์์ JSON ํํ๋ก http ํต์ ์ ํ๊ธฐ ์ํด json ํํ๋ก ๋ณํ์ ํ๋ ์ฝ๋์ด๋ค. NSMutableDictionary ํํ์ ๋ฐ์ดํฐ๋ฅผ NSJSONSerialization ์ ์ด์ฉํด NSData ๋ก ๋ณํํ ํ, ๋ค์ NSString ์ผ๋ก ๋ณํํ๋ค. NSMutableDictionary *retDic = [[NSMutableDictionary alloc]init]; [retDic setValue:๊ฐ1 forKey:@"ํค1"]; [retDic setValue:๊ฐ2 forKey:@"ํค2"]; NSData *requestData = [NSJSONSerialization dataWithJSONObject:retDic options:0 error:nil]; NSString *req.. 2021. 10. 6. ์ด์ 1 ๋ค์