{"id":1395,"date":"2015-10-14T09:03:50","date_gmt":"2015-10-14T09:03:50","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=1395"},"modified":"2022-02-17T06:24:02","modified_gmt":"2022-02-17T06:24:02","slug":"convert-array-to-string","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/memory\/arrays\/convert-array-to-string","title":{"rendered":"Convert Array To String"},"content":{"rendered":"<h4>\nConvert an array of DateTime&nbsp;values to a&nbsp;string and back again<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n\t\/\/CONVERT ARRAY OF DATE TIME TO COMMA SEPARATED STRING\r\n\tarray&lt;DateTime&gt; ^MyDateTimeArray;\r\n\tString ^MyString;\r\n\r\n\tMyString = &quot;&quot;;\r\n\tfor (Count = 0; Count &lt; MyDateTimeArray-&gt;Length; Count++)\r\n\t\tMyString += MyDateTimeArray[Count].ToString(&quot;yyyy-MM-ddTHH:mm:ss.fffffff&quot;) + &quot;,&quot;;\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<pre>\r\n<code>\r\n\t\/\/CONVERT COMMA SEPARATED STRING BACK TO ARRAY OF DATE TIME\r\n\tString ^sTemp;\r\n\twhile (1)\r\n\t{\r\n\t\t\/\/GET THE NEXT DATATIME VALUE (they are comma seperated and there is always a trailing comma)\r\n\t\tif (MyString-&gt;LastIndexOf(&quot;,&quot;) &lt;= 0)\r\n\t\t\tbreak;\r\n\t\tsTemp = MyString-&gt;Substring(0, (MyString-&gt;IndexOf(&quot;,&quot;)-1) );\r\n\t\tMyString = MyString-&gt;Substring( (MyString-&gt;IndexOf(&quot;,&quot;)+1) );\r\n\r\n\t\tArray::Resize(MyDateTimeArray, (MyDateTimeArray-&gt;Length + 1));\r\n\t\tMyDateTimeArray[(MyDateTimeArray->Length - 1)] = Convert::ToDateTime(sTemp);\r\n\t}\r\n<\/code><\/pre>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Convert an array of DateTime&nbsp;values to a&nbsp;string and back again \/\/CONVERT ARRAY OF DATE TIME TO COMMA SEPARATED STRING array&lt;DateTime&gt; ^MyDateTimeArray; String ^MyString; MyString = &quot;&quot;; for (Count = 0; Count &lt; MyDateTimeArray-&gt;Length; Count++) MyString += MyDateTimeArray[Count].ToString(&quot;yyyy-MM-ddTHH:mm:ss.fffffff&quot;) + &quot;,&quot;; &nbsp; \/\/CONVERT COMMA SEPARATED STRING BACK TO ARRAY OF DATE TIME String ^sTemp; while (1) { [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-1395","post","type-post","status-publish","format-standard","hentry","category-arrays"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=1395"}],"version-history":[{"count":4,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1395\/revisions"}],"predecessor-version":[{"id":1399,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1395\/revisions\/1399"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=1395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=1395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=1395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}