{"id":5008,"date":"2023-02-06T12:11:03","date_gmt":"2023-02-06T12:11:03","guid":{"rendered":"https:\/\/info.documotor.com\/?page_id=5008"},"modified":"2023-03-22T11:57:57","modified_gmt":"2023-03-22T11:57:57","slug":"substring","status":"publish","type":"page","link":"https:\/\/info.documotor.com\/?page_id=5008","title":{"rendered":"Substring"},"content":{"rendered":"\n<p>This function can be used to get a substring of a string.<\/p>\n\n\n\n<h3>Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string substring(string $text, integer $startIndex, integer $substringLength)<\/code><\/pre>\n\n\n\n<p>Gets the substring of $text.<br>The substring starts at $startIndex and will take up to $substringLength next characters or until the end of $text.<br>If $text is null the function will return null. If $startIndex is greater than the length of $text the function will return an empty string.<\/p>\n\n\n\n<h3>Parameters<\/h3>\n\n\n\n<p><strong>$text:<\/strong> The string to split.<br><strong>$startIndex:<\/strong> The zero index position in $text to start the substring from.<br><strong>$substringLength: <\/strong>The length of the substring i.e. number of characters to include<\/p>\n\n\n\n<h3>Example<\/h3>\n\n\n\n<pre title=\"Data\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json line-numbers\">{\n\t\"String\": \"Lorem Ipsum Dolor\"\n}<\/code><\/pre>\n\n\n\n<pre title=\"Transformation\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash line-numbers\">{\n\t\"NewString\": substring(String, `0`, `5`)\n}<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json line-numbers\">{\n\t\"NewString\": \"Lorem\"\n}<\/code><\/pre>\n\n\n\n<p>In this example the string value &#8220;String&#8221; has the substring extracted from the first 5 characters &#8220;Lorem&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This function can be used to get a substring of a string. Syntax Gets the substring of $text.The substring starts at $startIndex and will take up to $substringLength next characters or until the end of $text.If $text is null the function will return null. If $startIndex is greater than the length of $text the function [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"parent":271,"menu_order":186,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/5008"}],"collection":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5008"}],"version-history":[{"count":1,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/5008\/revisions"}],"predecessor-version":[{"id":5009,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/5008\/revisions\/5009"}],"up":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/271"}],"wp:attachment":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}