{"id":1937,"date":"2022-09-12T20:25:39","date_gmt":"2022-09-12T20:25:39","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=1937"},"modified":"2022-09-12T20:25:41","modified_gmt":"2022-09-12T20:25:41","slug":"java-string-contains","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/java-string-contains\/","title":{"rendered":"Java String contains() Method"},"content":{"rendered":"<p style=\"text-align: center;\"><strong>Java String Contains<\/strong><\/p>\n\n\n<p>With this method, we can know whether or not the specified string contains the given character sequence. This is like finding whether plain is present in &#8221;complaint&#8221;, and we have a true output.<\/p>\n\n\n\n<p>Well, let&#8217;s have a simple program for understanding the method and observing output &#8211;<\/p>\n\n\n\n<p class=\"has-background-color has-foreground-background-color has-text-color has-background\">public class StringMethods {<br>public static void main(String[] args) {<br>String exampleString = &#8220;complaint&#8221;;<br>System.out.println(exampleString.contains(&#8220;plain&#8221;));<br>}<br>}<\/p>\n\n\n\n<p>So, just executing this example comes up with the true output. This is because the example string contains the given character sequence. Just keep in mind that this method is case-sensitive.<\/p>\n\n\n\n<p>So, you can do something like converting both the string and the character sequence that you are going to check into some convenient case before you really invoke the method.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java String Contains With this method, we can know whether or not the specified string contains the given character sequence. This is like finding whether plain is present in &#8221;complaint&#8221;, and we have a true output. Well, let&#8217;s have a simple program for understanding the method and observing output &#8211; public class StringMethods {public static [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[12,11],"class_list":{"0":"post-1937","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-java-tutorial","7":"tag-java","8":"tag-java-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=1937"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1937\/revisions"}],"predecessor-version":[{"id":3017,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1937\/revisions\/3017"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=1937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=1937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=1937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}