SRL Archive - OSR Help

Printing TIntegerArray Help


BraK

2011-12-09 03:50:31

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:

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


Not like this

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 :(

Gu3st...

2011-12-09 04:02:21

WriteLn(Arr);
Should work just fine.

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

mormonman

2011-12-09 04:04:36

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

BraK

2011-12-09 05:45:29

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.

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 ;)

YoHoJo

2011-12-09 09:02:31

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

BraK

2011-12-09 10:31:52

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.

Nava2

2011-12-09 10:55:00

I wish there was a flag in WriteLn that didn't automatically add a '\n' char. :(

Dgby714

2011-12-09 10:58:13

From: Nava2
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.