{"id":4252,"date":"2022-03-09T16:53:27","date_gmt":"2022-03-09T16:53:27","guid":{"rendered":"https:\/\/ibex.tech\/python\/?p=4252"},"modified":"2025-01-23T13:13:37","modified_gmt":"2025-01-23T13:13:37","slug":"using-strings-searching-strings","status":"publish","type":"post","link":"https:\/\/ibex.tech\/python\/strings-python\/using-strings-searching-strings","title":{"rendered":"Using Strings-Searching Strings"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Does String Contain String<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">in<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>if \"c\" in \"abcdef\":     \n  #Character found\n\nif \"cde\" in \"abcdef\":     \n  #String found\n\nif my_string.find(\"abc\") &gt;= 0:    #find() returns index or -1 if not found\n  #String found<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Does string start with<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>if my_string.find(\"abc\") == 0:    #find() returns index or -1 if not found\n  #Starts with string<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Case insitive<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>if my_string.lower().find(\"abc\") == 0:    #find() returns index or -1 if not found\n  #Starts with string<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Does string end with<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>if my_string.endswith(\"abc\"):\n  #Ends with string<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Does String Contain String in Does string start with Case insitive Does string end with<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[319],"tags":[],"class_list":["post-4252","post","type-post","status-publish","format-standard","hentry","category-strings-python"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/comments?post=4252"}],"version-history":[{"count":5,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4252\/revisions"}],"predecessor-version":[{"id":4841,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4252\/revisions\/4841"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/media?parent=4252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/categories?post=4252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/tags?post=4252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}