{"id":881,"date":"2024-12-12T09:59:03","date_gmt":"2024-12-12T09:59:03","guid":{"rendered":"https:\/\/monkey.ploogie.co.uk\/?page_id=881"},"modified":"2024-12-12T11:39:59","modified_gmt":"2024-12-12T11:39:59","slug":"mwnci-getblock-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-getblock-function\/","title":{"rendered":"Mwnci getblock() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>getblock(<strong><em>string<\/em>, <em>string<\/em>, <em>array<\/em><\/strong>)<br \/>\ngetfileblock(<strong><em>string<\/em>, <em>string<\/em>, <em>file<\/em><\/strong>)<\/p>\n<h2>Description<\/h2>\n<p>The <i>getblock()<\/i> and <i>getfileblock()<\/i> return an array of strings between and including the first string an second string.  <i>getblock()<\/i> will use the data on a pre-defined array, while <i>getfileblock<\/i> reads a file into an array prior to calling <i>getblock()<\/i><\/p>\n<h2>Example<\/h2>\n<p>Data file &#8220;bdata&#8221;<\/p>\n<pre>\r\nblock_start\r\nThis is a small\r\nblock of text\r\nthat may or may not\r\nbe seen\r\nblock_end\r\nData starts here for the second test\r\nwhich may also be found\r\nright up to\r\nData ends here\r\n<\/pre>\n<pre>\r\n\/\/ Using getblock\r\nData=split(trim(cat(\".\/bdata\")), \"\\n\")\r\nFirstBlock=getblock(\"block_start\", \"block_end\", Data)\r\nSecondBlock=getblock(\"Data starts\", \"Data ends\", Data)\r\nprintln(\"Data=\", Data, \"\\n\")\r\nprintln(FirstBlock,\"\\n\", SecondBlock)\r\nprintln()\r\nprintln()\r\n\r\nData=[\"block_start\", \"This is a small\", \"block of text\", \"that may or may not\", \"be seen\", \"block_end\", \"Data starts here for the second test\", \"which may also be found\", \"right up to\", \"Data ends here\"]\r\n\r\n[\"block_start\", \"This is a small\", \"block of text\", \"that may or may not\", \"be seen\", \"block_end\"]\r\n[\"Data starts here for the second test\", \"which may also be found\", \"right up to\", \"Data ends here\"]\r\n\r\n\r\n\r\n\/\/Using getfileblock\r\nFirstBlock=getfileblock(\"block_start\", \"block_end\", \".\/bdata\")\r\nSecondBlock=getfileblock(\"Data starts\", \"Data ends\", \".\/bdata\")\r\nprintln(FirstBlock,\"\\n\", SecondBlock)\r\n\r\n\r\n[\"block_start\", \"This is a small\", \"block of text\", \"that may or may not\", \"be seen\", \"block_end\"]\r\n[\"Data starts here for the second test\", \"which may also be found\", \"right up to\", \"Data ends here\"]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax getblock(string, string, array) getfileblock(string, string, file) Description The getblock() and getfileblock() return an array of strings between and including the first string an second string. getblock() will use the data on a pre-defined array, while getfileblock reads a file into an array prior to calling getblock() Example Data file &#8220;bdata&#8221; block_start This is a &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-getblock-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci getblock() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-881","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=881"}],"version-history":[{"count":8,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/881\/revisions"}],"predecessor-version":[{"id":890,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/881\/revisions\/890"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}