{"id":17,"date":"2014-05-27T22:39:25","date_gmt":"2014-05-27T22:39:25","guid":{"rendered":"http:\/\/localhost\/wordpress\/?p=17"},"modified":"2014-05-28T14:42:55","modified_gmt":"2014-05-28T14:42:55","slug":"string-contains-other-or-not","status":"publish","type":"post","link":"https:\/\/blog.silverterra.net\/?p=17","title":{"rendered":"string contains other or not"},"content":{"rendered":"<p>in c# we can use to check a string<\/p>\n<pre data-enlighter-language=\"csharp\" class=\"EnlighterJSRAW\">\r\n\/\/ This example demonstrates the String.Contains() method \r\nusing System;\r\n\r\nclass Sample \r\n{\r\n    public static void Main() \r\n    {\r\n    string s1 = &quot;The quick brown fox jumps over the lazy dog&quot;;\r\n    string s2 = &quot;fox&quot;;\r\n    bool b;\r\n    b = s1.Contains(s2);\r\n    Console.WriteLine(&quot;Is the string, s2, in the string, s1?: {0}&quot;, b);\r\n    }\r\n}\r\n\/*\r\nThis example produces the following results:\r\n\r\nIs the string, s2, in the string, s1?: True\r\n*\/\r\n<\/pre>\n<p>So I need a similar function in javascript. Here is:<\/p>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\r\nif (!String.prototype.Contains) {\r\n  Object.defineProperty(String.prototype, 'Contains', {\r\n    enumerable: false,\r\n    configurable: false,\r\n    writable: false,\r\n    value: function (s) {\r\n      return !!~this.indexOf(s);\r\n    }\r\n  });\r\n};\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>in c# we can use to check a string So I need a similar function in javascript. Here is:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":2,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/46"}],"wp:attachment":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}