{"id":8521,"date":"2021-08-12T22:17:25","date_gmt":"2021-08-12T19:17:25","guid":{"rendered":"https:\/\/elzero.org\/?p=8521"},"modified":"2022-08-07T07:06:29","modified_gmt":"2022-08-07T04:06:29","slug":"javascript-problems-solving-remove-character-from-string","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/javascript-problems-solving-remove-character-from-string\/","title":{"rendered":"Remove Character From String"},"content":{"rendered":"<h3>\u0627\u0644\u062d\u0644 \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u0641\u064a\u062f\u064a\u0648<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\nfunction removeCharFrom(word, c) {\r\n  return word\r\n    .split(\"\") \/\/ Convert To Array\r\n    .filter(function (char) { \/\/ Filter Small And Capital Character From Array Elements\r\n      return char !== c.toLowerCase() && char !== c.toUpperCase();\r\n    }).join(\"\"); \/\/ Join Array Elements Again in One String\r\n}\r\n\r\n\/\/ Arrow Function Version\r\n\r\nfunction removeCharFrom(word, c) {\r\n  return word.split(\"\").filter((x) => x !== c.toLowerCase() && x !== c.toUpperCase()).join(\"\");\r\n}\r\n\r\nconsole.log(removeCharFrom(\"ElddzeroD WebDD ddSchool\", \"d\"));\r\nconsole.log(removeCharFrom(\"ElxzeroX Web Sxchool\", \"x\"));\r\nconsole.log(removeCharFrom(\"Elzero@ Web@@ @@School\", \"@\"));\r\n<\/script>\r\n\r\n<h3>\u0627\u0644\u062d\u0644 \u0627\u0644\u062b\u0627\u0646\u064a<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\nfunction removeCharFrom(word, c) {\r\n  let regular = new RegExp(`${c}`, \"gi\");\r\n  return word.replace(regular, \"\");\r\n}\r\n\r\nconsole.log(removeCharFrom(\"ElddzeroD WebDD ddSchool\", \"d\"));\r\nconsole.log(removeCharFrom(\"ElxzeroX Web Sxchool\", \"x\"));\r\nconsole.log(removeCharFrom(\"Elzero@ Web@@ @@School\", \"@\"));\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>\u0627\u0644\u062d\u0644 \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u0641\u064a\u062f\u064a\u0648 \u0627\u0644\u062d\u0644 \u0627\u0644\u062b\u0627\u0646\u064a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1337],"tags":[],"class_list":["post-8521","post","type-post","status-publish","format-standard","hentry","category-problems-solving"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=8521"}],"version-history":[{"count":5,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8521\/revisions"}],"predecessor-version":[{"id":8539,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8521\/revisions\/8539"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}