{"id":357,"date":"2014-05-19T09:03:07","date_gmt":"2014-05-19T07:03:07","guid":{"rendered":"http:\/\/dev.flauschig.ch\/wordpress\/?p=357"},"modified":"2014-05-19T09:03:07","modified_gmt":"2014-05-19T07:03:07","slug":"removing-control-characters-from-string","status":"publish","type":"post","link":"http:\/\/dev.flauschig.ch\/wordpress\/?p=357","title":{"rendered":"Removing Control Characters from String"},"content":{"rendered":"<p>Following code will remove all non-printable characters from a string.<\/p>\n<pre class=\"lang:c# decode:true \"> StringBuilder cleanString = new StringBuilder();\r\n foreach (char character in inputString)\r\n {\r\n     if (Char.IsControl(character))\r\n     {\r\n         if (Char.IsWhiteSpace(character))\r\n         {\r\n             cleanString.Append(\" \");\r\n         }\r\n         continue;\r\n     }\r\n     cleanString.Append(character);\r\n }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Following code will remove all non-printable characters from a string. StringBuilder cleanString = new StringBuilder(); foreach (char character in inputString) { if (Char.IsControl(character)) { if (Char.IsWhiteSpace(character)) { cleanString.Append(&#8221; &#8220;); } continue; } cleanString.Append(character); }<\/p>\n","protected":false},"author":370,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4,3],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-against","4":"post-357","6":"format-standard","7":"category-csharp","8":"category-programming"},"acf":[],"views":2550,"_links":{"self":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/357"}],"collection":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/370"}],"replies":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357"}],"version-history":[{"count":0,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions"}],"wp:attachment":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}