YoHoJo
2009-10-16 03:41:50
EDIT:
So even before I posted this I found out how to fix it myself! :spot:
So/.. SRL's
Should be:
I will leave the original post below just because…
So even before I posted this I found out how to fix it myself! :spot:
So/.. SRL's
function intArrayToStrEx(intArray: TIntegerArray; Separater: string): string;
var
i, arrayLength: Integer;
begin
arrayLength := Length(intArray);
repeat
Result := Result + IntToStr(intArray[i]);
if (not i = (arrayLength - 1)) then
Result := Result + Separater;
Inc(i);
until (i = arrayLength)
end;Should be:
function intArrayToStrEx(intArray: TIntegerArray; Separater: string): string;
var
i, arrayLength: Integer;
begin
arrayLength := Length(intArray);
repeat
Result := Result + IntToStr(intArray[i])+ Separater;
if (not i = (arrayLength - 1)) then
Result := Result + Separater;
Inc(i);
until (i = arrayLength)
end;I will leave the original post below just because…
Here some test/sample/help me understand script thingy I make with some help from Boreas:
(The actual intArrayToStrEx function is in the code below at the top)program New;
var
Slot:Array of Integer;
AL,Target:Integer;
function intArrayToStrEx(intArray: TIntegerArray; Separater: string): string;
var
i, arrayLength: Integer;
begin
arrayLength := Length(intArray);
repeat
Result := Result + IntToStr(intArray[i]);
if (not i = (arrayLength - 1)) then
Result := Result + Separater;
Inc(i);
until (i = arrayLength)
end;
Procedure DeclareSlots;
Begin
SetArrayLength(Slot,2);
Slot[0]:=1;
Slot[1]:=4;
End;
Procedure AddSlot(WhatSlot:Integer);
Begin
SetArrayLength(Slot,GetArrayLength(Slot)+1);
Slot[GetArrayLength(Slot)-1]:=WhatSlot;
End;
Procedure RemoveSlot(WhatSlot:Integer);
Begin
If GetArrayLength(Slot)=0 Then Exit;
AL:=GetArrayLength(Slot);
Target:=0;
Repeat
Begin
If Slot[Target]=WhatSlot Then Break;
Inc(Target);
End;
Until(False)
Slot[Target]:=Slot[GetArrayLength(Slot)-1];
SetArrayLength(Slot,GetArrayLength(Slot)-1)
End;
begin
DeclareSlots;
Writeln(IntArrayToStrEx(Slot,'.'));
AddSlot(6);
Writeln(IntArrayToStrEx(Slot,'.'));
RemoveSlot(6);
Writeln(IntArrayToStrEx(Slot,'.'));
end.
As you can see near the bottom:Writeln(IntArrayToStrEx(Slot,'.'));
Should spit out the array, and then a "." after each integer.
Ive also tried, letters (capital and lowercase) and numbers, and both don't work. By looking though the function, I have no idea why it isn't working.