文字列 0..9 を秒として表示し、10 個の単語から秒として表示したいアプリケーションがあります。 .9 または 10 個の独自の単語の場合、当然 1 と 2 として与える必要がありますが、この奇妙な動作の理由がわかりませんでした。
todaysdateString1= [NSString stringWithFormat:@"%2ld",seconds];
int myLength2 = [todaysdateString1 length];
NSString *subtitle;
NSLog(@"%@",todaysdateString1);
NSLog(@"%d",myLength2);
if(myLength2==2)
subtitle = [NSString stringWithString:@"second"];
else
subtitle = [NSString stringWithString:@"seconds"];
todaysdateString1 = [todaysdateString1 stringByAppendingFormat:@" %@",subtitle];
「誰か助けてくれませんか?