{"id":157,"date":"2016-02-08T13:20:44","date_gmt":"2016-02-08T13:20:44","guid":{"rendered":"http:\/\/vladymix.es\/?p=157"},"modified":"2016-02-08T13:27:31","modified_gmt":"2016-02-08T13:27:31","slug":"remover-acentos","status":"publish","type":"post","link":"https:\/\/vladymix.es\/wordpress\/index.php\/2016\/02\/08\/remover-acentos\/","title":{"rendered":"Remover acentos"},"content":{"rendered":"<p>Alguna vez nos ha tocado remover los acentos a una cadena. La forma m\u00e1s r\u00e1pida y f\u00e1cil seria con un replace.<\/p>\n<pre class=\"lang:c# decode:true \" title=\"Example\">public static class ExtentionsString\r\n{\r\n\r\n public static string RemoveAccents(this string value)\r\n        {\r\n        var sourceWithoutAccents =  value.Replace(\"\u00e1\",\"a\");\r\n            sourceWithoutAccents =  sourceWithoutAccents.Replace(\"\u00e9\",\"e\");\r\n            sourceWithoutAccents =  sourceWithoutAccents.Replace(\"\u00ed\",\"i\");\r\n            sourceWithoutAccents =  sourceWithoutAccents.Replace(\"\u00f3\",\"o\");\r\n            sourceWithoutAccents =  sourceWithoutAccents.Replace(\"\u00fa\",\"u\");\r\n\r\n       return sourceWithoutAccents ;\r\n      }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Aqu\u00ed les dejo en un par de lineas de c\u00f3digo para una\u00a0forma mas r\u00e1pida y limpia (Este m\u00e9todo tiene que ir dentro de una clase est\u00e1tica).<\/p>\n<pre class=\"lang:c# decode:true\" title=\"String with out accents\">  \r\npublic static class ExtentionsString\r\n{\r\n\r\n public static string RemoveAccents(this string value)\r\n        {\r\n            Encoding destEncoding = Encoding.GetEncoding(\"iso-8859-8\");\r\n\r\n            return destEncoding.GetString(Encoding.Convert(Encoding.UTF8, destEncoding, Encoding.UTF8.GetBytes(value)), 0, value.Length);\r\n        }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Para utilizarlo dentro de un m\u00e9todo:<\/p>\n<pre class=\"lang:c# decode:true\" title=\"Example Accents\"> public static void MyMethod()\r\n        {\r\n           var source = \"Configuraci\u00f3n\"\r\n           var sourceWithOutAccents = source.RemoveAccents();\r\n\r\n        }<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Alguna vez nos ha tocado remover los acentos a una cadena. La forma m\u00e1s r\u00e1pida y f\u00e1cil seria con un&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,4],"tags":[],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-c","category-windows-store-and-phone"],"_links":{"self":[{"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":7,"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":164,"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions\/164"}],"wp:attachment":[{"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vladymix.es\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}