Results 1 to 8 of 8

Thread: Printing TIntegerArray Help

  1. #1
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default Printing TIntegerArray Help

    I trying to Print a Tinteger array to the Debug box. But I don't want it to print them all on a separate line. I want it to print it like an Array.

    Like this:
    Code:
    Integers := [111, 222, 333, 444, 555, 666];

    Not like this
    Code:
    111
    222
    333
    444
    555
    666
    Hopefully someone can give me a hand. Dealing with Strings isn't my strong point.

    E: We need a function that prints TVariantArray's

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    WriteLn(Arr);
    Should work just fine.

    it works with TVariantArray too;
    WriteLn(['Hello', 'world', 123]);

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Writeln('Integers := ' + ToStr(ArrayHere));

  4. #4
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Thanks guys I'm working on a utility that will print out an Array of Colors from the Bank that are not in any of the Other desiganated Bankslots. Running it with resarting RS a few times will give you a reliable list of color that can be used for CTS2 color finding procedures.

    Code:
    program new;
    {$I srl/srl.scar}
    var
      II, III, Ending, Deleted: TIntegerArray;
    
    Function DeleteInIntArray(Checked, Delete:Tintegerarray;var Cleared: TIntegerArray):TIntegerArray;
    var
      AAA, AA: TintegerArray;
      I: integer;
    begin
      ClearSameIntegers(Checked);
      ClearSameIntegers(Delete);
      For I := 0 to High(Checked) do
        If not InIntArray(Delete, Checked[i]) then
        Begin
          SetArrayLength(AAA, Length(AAA) + 1);
          AAA[(Length(AAA) - 1)] := Checked[i];
        end else
        begin
          SetArrayLength(AA, Length(AA) + 1);
          AA[(Length(AA) - 1)] := Checked[i];
        end;
      Result := AAA;
      Cleared := AA;
    end;
    
    begin
      II := [11,22,33,44,55,66,77,88,99];
      III := [22,44,66,88];
      Ending := DeleteInIntArray(II, III, Deleted);
      Writeln('Starting Array := ' + tostr(II));
      Writeln('Sorting Array := ' + tostr(III));
      Writeln('Deleted Array := ' + tostr(Deleted));
      writeln('Remaining Array := ' + tostr(Ending));
    end.
    Here's the starting basis for it. I'll probably work on it more at the House(currently at work).

    E: I Rep+ you both
    Last edited by BraK; 12-15-2011 at 03:55 PM.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  5. #5
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    You guys are over complicating things
    WriteLn('Integers := [111, 222, 333, 444, 555, 666];');
    DUH!

  6. #6
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Nah for larger Arrays is what I'm using this for. It'll be easier to use writeln(tostr(Arr)); then writing the whole thing out.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  7. #7
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    I wish there was a flag in WriteLn that didn't automatically add a '\n' char.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  8. #8
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    I wish there was a flag in WriteLn that didn't automatically add a '\n' char.
    It's called Write, tho idk if PS has it. Pascal and Lape do.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •