How do i set placeholder char(%)?
-
13-09-2019 - |
Question
In Objective-c ... I want represent placeholder char(%) but my code don't....
NSString *base = @"<style type=\"test/css\">div{width:100\%}</style><body>%@</body>";
NSString *html = [NSString stringWithFormat:base, @"hello world"];
NSLog(@"%@",html);
- expect : div{width:100%}
- real : div{width:100}
what is wrong?
Solution
Try this:
NSString *base = @"<style type=\"test/css\">div{width:100%%}</style><body>%@</body>";
The full list of format specifiers is here.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow