delphi - Is there an easy way to clone a string array? -
I have been declared as an array:
const A: array [0 ..3] short string = ('customer', 'supplementary', 'stock', 'gl'); Var B: Array of Shortstring;
I would like to clone the string array. Use B.B in another array or copy function is not working. Is there a fast and easy way to clone the array without using the loop?
Your problem is to encounter your constant A and your variables < Strong> B are actually different types, it shows you that you can declare one cost and one type of fire equal to what you show in your question:
Type TSA = array [0] .3] short string; Const A: TSA = ('Customer', 'Supplier', 'Stock', 'GL'); Var B: TSA;
With these announcements you can simply write:
b: = a;
But when A is a one-dimensional array and B is a dynamic array, this is not possible and your only choice is SetLength (B) as required and copy one-by-one element.
However, the type const and var appear as if they are identical - or compatible types - they are not, and then string Continuous integer for the variable is no different than trying it. Even if you know the simple conversion needed to achieve this, compiler estimates You can not predict that you intend to do this, so you must clearly convert the conversion code Do not be.
Comments
Post a Comment