자리 표시 자 char (%)를 어떻게 설정합니까?
-
13-09-2019 - |
문제
Objective-C에서 ... 나는 자리 표시 자 char (%)를 대표하고 싶지만 내 코드는 그렇지 않습니다 ....
NSString *base = @"<style type=\"test/css\">div{width:100\%}</style><body>%@</body>";
NSString *html = [NSString stringWithFormat:base, @"hello world"];
NSLog(@"%@",html);
- 기대 : div {너비 : 100%}
- Real : div {너비 : 100}
뭐가 잘못 되었 니?
해결책
이 시도:
NSString *base = @"<style type=\"test/css\">div{width:100%%}</style><body>%@</body>";
형식 지정자의 전체 목록은 다음과 같습니다 여기.
제휴하지 않습니다 StackOverflow