{"id":767,"date":"2024-11-28T11:36:26","date_gmt":"2024-11-28T11:36:26","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=767"},"modified":"2024-11-28T12:05:40","modified_gmt":"2024-11-28T12:05:40","slug":"mwnci-string-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-string-function\/","title":{"rendered":"Mwnci string() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>string<strong>(<em>object<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>string()<\/i> function returns a stringified version of the variable type given. That is, any <em>int<\/em>, <em>float<\/em>, <em>array<\/em>, <em>hash<\/em>, <em>bool<\/em> etc will be converted into a string.<\/p>\n<h2>Example<\/h2>\n<pre>\r\na=[1,2,3,4, \"five\"]\r\nb=string(a)\r\nprintln(\"OriginalType=\", type(a), \" NewType=\", type(b), \" Value=\",\"\\\"\",b,\"\\\"\")\r\na={\"One\": 1, \"Two\": 2}\r\nb=string(a)\r\nprintln(\"OriginalType=\", type(a), \" NewType=\", type(b), \" Value=\",\"\\\"\",b,\"\\\"\")\r\na=100\r\nb=string(a)\r\nprintln(\"OriginalType=\", type(a), \" NewType=\", type(b), \" Value=\",\"\\\"\",b,\"\\\"\")\r\na=true\r\nb=string(a)\r\nprintln(\"OriginalType=\", type(a), \" NewType=\", type(b), \" Value=\",\"\\\"\",b,\"\\\"\")\r\na=1.1\r\nb=string(a)\r\nprintln(\"OriginalType=\", type(a), \" NewType=\", type(b), \" Value=\",\"\\\"\",b,\"\\\"\")\r\n\r\n\r\nOriginalType=array NewType=string Value=\"[1, 2, 3, 4, \"five\"]\"\r\nOriginalType=hash NewType=string Value=\"{\"One\": 1, \"Two\": 2}\"\r\nOriginalType=integer NewType=string Value=\"100\"\r\nOriginalType=bool NewType=string Value=\"true\"\r\nOriginalType=float NewType=string Value=\"1.1\"\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax string(object) Description The string() function returns a stringified version of the variable type given. That is, any int, float, array, hash, bool etc will be converted into a string. Example a=[1,2,3,4, &#8220;five&#8221;] b=string(a) println(&#8220;OriginalType=&#8221;, type(a), &#8221; NewType=&#8221;, type(b), &#8221; Value=&#8221;,&#8221;\\&#8221;&#8221;,b,&#8221;\\&#8221;&#8221;) a={&#8220;One&#8221;: 1, &#8220;Two&#8221;: 2} b=string(a) println(&#8220;OriginalType=&#8221;, type(a), &#8221; NewType=&#8221;, type(b), &#8221; Value=&#8221;,&#8221;\\&#8221;&#8221;,b,&#8221;\\&#8221;&#8221;) a=100 b=string(a) &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-string-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci string() 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-767","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/767","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=767"}],"version-history":[{"count":3,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/767\/revisions"}],"predecessor-version":[{"id":770,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/767\/revisions\/770"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}