{"id":170,"date":"2008-11-24T20:01:15","date_gmt":"2008-11-25T01:01:15","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/11\/24\/how-to-put-a-in-an-nsstringnslogprintf\/"},"modified":"2008-11-24T20:01:17","modified_gmt":"2008-11-25T01:01:17","slug":"how-to-put-a-in-an-nsstringnslogprintf","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/11\/24\/how-to-put-a-in-an-nsstringnslogprintf\/","title":{"rendered":"How To Put a % in an NSString\/NSLog\/printf"},"content":{"rendered":"<p><code>%%<\/code> is turned into a single <code>%<\/code> in a call to <code>NSLog<\/code>, or <code>-[NSString stringWithFormat:]<\/code>, or the <code>printf<\/code>-family of functions.<\/p>\n<p>Note that <code>%%<em>format<\/em><\/code> will become <code>%<em>format<\/em><\/code>, even if <code>%<em>format<\/em><\/code> usually prints an argument.  For example, the code<\/p>\n<p><code>NSLog(@\"%%a will print a float in a machine-readable format, so that *scanf can read it back in from a string with no loss of precision.\", 1.0f);<br \/><\/code><\/p>\n<p>prints:<\/p>\n<blockquote><p>%a will print a float in a machine-readable format, so that *scanf can read<br \/>\nit back in from a string with no loss of precision.<\/p><\/blockquote>\n<p><em>not<\/em>:<\/p>\n<blockquote><p>%0x1p+0 will print a float in a machine-readable format, so that *scanf can read it back in from a string with no loss of precision.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>%% is turned into a single % in a call to NSLog, or -[NSString stringWithFormat:], or the printf-family of functions. Note that %%format will become %format, even if %format usually prints an argument. For example, the code NSLog(@&#8221;%%a will print a float in a machine-readable format, so that *scanf can read it back in from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,3,5,4],"tags":[613,156,76,83,78,230,231],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-cocoa","category-macosx","category-objective-c","category-programming","tag-c","tag-foundation","tag-gcc","tag-nslog","tag-nsstring","tag-printf","tag-scanf"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}