Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 593427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:50:41+00:00 2026-05-13T15:50:41+00:00

I have an array declared as: const A: array[0..3] of ShortString = ( ‘Customer’,

  • 0

I have an array declared as:

const A: array[0..3] of ShortString = (
  'Customer',
  'Supplier',
  'Stock',
  'GL'
);

var B: array of ShortString;

I would like to clone the string array A to another array B. Using Move or Copy function doesn’t work. Is there a fast and easy way to clone the array without using for loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:50:41+00:00Added an answer on May 13, 2026 at 3:50 pm

    The problem you face is that your constant A and your variable B are actually of different types. This can be demonstrated most easily by showing how you would declare a const and a var of the same type in a fashion equivalent to what you show in your question:

    type
      TSA = array[0..3] of ShortString;
    
    const
      A: TSA = (
      'Customer',
      'Supplier',
      'Stock',
      'GL');
    
    var B: TSA;
    

    With these declarations you could then simply write:

    B := A;
    

    But when A is a dimensioned array and B is a dynamic array, this isn’t possible and your only option is to SetLength(B) as required and copy the elements one-by-one.

    Although the const and the var types may look like they are the same – or compatible types – they are not, and this then is no different from trying to assign an Integer constant to a String variable… even though you know the simple conversion required to achieve it, the compiler cannot presume to guess that you intended this, so you have to be explicit and provide the conversion code yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 436k
  • Answers 436k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You are guaranteed some sort of initialization. For any static… May 15, 2026 at 3:50 pm
  • Editorial Team
    Editorial Team added an answer Does it have to be a header? Can you just… May 15, 2026 at 3:50 pm
  • Editorial Team
    Editorial Team added an answer Yes, as you said, Moles can mock any .NET type… May 15, 2026 at 3:49 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.