{"id":332,"date":"2010-07-08T20:26:12","date_gmt":"2010-07-08T20:26:12","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=332"},"modified":"2022-02-17T06:24:05","modified_gmt":"2022-02-17T06:24:05","slug":"strings-general","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/strings\/strings-general","title":{"rendered":"Strings General"},"content":{"rendered":"<p>The string type is a library type and is actaully an array of char or wchar_t.  The last character in a string is always null.<br \/>\nThe library takes care of managing the memory associated with storing the elements.  As well as being less powerful, C-style strings are the root cause of many many security problems, so always use the string library instead.<\/p>\n<h4>Literal Strings<\/h4>\n<p>Put an L in front:<\/p>\n<pre><code>WriteLine(L\"This is my string\");<\/code><\/pre>\n<h4>Declare a string<\/h4>\n<pre><code>\r\nString ^sTemp;\r\nString ^sTemp = \"\";\r\n<\/code><\/pre>\n<h4>Declare A Global String<\/h4>\n<p>Just declare in the valraible area.  No need to create in the constructor as the string will simply by a null pointer until it is written to (null string handles get constructed when writing to them)<br \/>\nPrivate: String ^sTemp;<\/p>\n<h4>Is String Handle Null?<\/h4>\n<pre><code>\r\n\tif (MyString == nullptr)\r\n\t\tMyString = \"\";\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The string type is a library type and is actaully an array of char or wchar_t. The last character in a string is always null. The library takes care of managing the memory associated with storing the elements. As well as being less powerful, C-style strings are the root cause of many many security problems, [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-332","post","type-post","status-publish","format-standard","hentry","category-strings"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/332","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=332"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/332\/revisions"}],"predecessor-version":[{"id":336,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/332\/revisions\/336"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}