#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    12
    Rep Power
    0

    Dynamic Array to Array OR String to Char


    Edit : Ok, sorry, I'm stupid, I tried myString[0] and it did not work..... I should have tried myString[1] instead....! Well... I still want to know what would be the best way to solve the "Dynamic Array VS Array" problem.


    I am filling some dynamic arrays with a variable number of items (determined at runtime). Some of them are String arrays, one of them is a Char array.

    Passing these arrays to :

    myFunction(asStrings1 : Array of String; asStrings2 : Array of String; acChars : Array of Char);

    I get the following error for the Array of Char argument :
    Incompatible types: 'Array' and 'dynamic array'.

    How could I pass a Dynamic Array of Char to my fonction?
    I thought I could use a String array instead. But I did not find a way to convert my "one character string" to a Char. I did not find a "String.CharAt" fonction in Delphi.

    Anyone knows how to solve my "Array and Dynamic Array" or my "String to Char" problem?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    To pass an array of strings, use a TStringList object instead. As for an array of char, pass a String object instead. Both these objects are dynamic.
    myfunction(aStrings1, aStrings2: TStringList; acChars : string);
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    12
    Rep Power
    0
    Of course... thanks!

IMN logo majestic logo threadwatch logo seochat tools logo