728x90
์๋ ์์ ์์ ๋ ๊ฐ์ง๋ฅผ ์ ๋ฆฌํ๋ค.
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("%s\n", [nsStr UTF8String]);
}
'๐ ๊ฐ๋ฐ > iOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Mac] ๋งฅ ํ์ผ ๋น๊ต ํ๋ก๊ทธ๋จ : FileMerge (0) | 2022.01.14 |
---|---|
[iOS] Showing Recent MessagesNo account for team "ํ๊ณ์ ". Add a new account in the Accounts preference pane or verify that your accounts have valid credentials. (1) | 2022.01.06 |
[Mac] zsh: permission denied: ./sample.sh (0) | 2021.11.23 |
[Mac] ๋งฅ์ฉ SVN ์ค์น : SnailSVN Lite (2) | 2021.11.05 |
[iOS] Xcode Build (0) | 2021.10.21 |
๋๊ธ