{"id":1368,"date":"2012-06-25T11:03:21","date_gmt":"2012-06-25T18:03:21","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=1368"},"modified":"2015-04-07T08:49:57","modified_gmt":"2015-04-07T15:49:57","slug":"using-in-nsstring","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=1368","title":{"rendered":"Using % in NSString"},"content":{"rendered":"<p>It probably says this somewhere, but I missed it. I\u2019m writing results to the screen and to a file and it works fine with this code for my table headers:<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\ntableHeader = @&quot;&lt;table width=&#039;100%&#039; border=&#039;1&#039;&gt;&lt;tr&gt;&lt;th colspan=&#039;2&#039;&gt;Presentations&lt;\/th&gt;&lt;\/tr&gt;&quot;;\n<\/code><\/pre><\/p>\n<p>I wanted to adjust the colspan depending on the number of presentations for different conditions. So I put the code into an NSString like so:<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\nNSInteger numColumns = 6;\ntableHeader = [NSString stringWithFormat:@&quot;&lt;table width=&#039;100%&#039; border=&#039;1&#039;&gt;&lt;tr&gt;&lt;th colspan=&#039;%d&#039;&gt;Presentations&lt;\/th&gt;&lt;\/tr&gt;&quot;, numColumns];\n<\/code><\/pre><\/p>\n<p>The table no longer takes up the whole page. I tried escaping the 100% like you normally do \\% but that didn\u2019t do anything. The correct way to escape a percent sign is to double it. e.g. %%<\/p>\n<p>So now you know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It probably says this somewhere, but I missed it. I\u2019m writing results to the screen and to a file and it works fine with this code for my table headers: tableHeader = @&quot;&lt;table width=&#039;100%&#039; border=&#039;1&#039;&gt;&lt;tr&gt;&lt;th colspan=&#039;2&#039;&gt;Presentations&lt;\/th&gt;&lt;\/tr&gt;&quot;; I wanted to adjust the colspan depending on the number of presentations for different conditions. So I put the &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=1368\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Using % in NSString<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-1368","post","type-post","status-publish","format-standard","hentry","category-ios"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1368"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1368\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}