SRL Archive - OSR Help

Arrays


DeSnob

2011-12-05 19:22:58

I'm having unreasonable issues with these arrays I use in a special pixel-counting uptext function. I've tested it with everything commented out.
Function ReturnUptextPixels(Text: string): integer;
var
i, i2, i3, L: Integer;
Letter: String;
Alphabet: TStringArray;
LowerP, UpperP: TIntegerArray;
begin
SetLength(UpperP, 25);
LowerP := [24, 33, 16, 33, 24, 27, 37, 34, 12, 25, 31, 20, 36, 26, 24, 33, 31 +
15, 20, 21, 24, 20, 28, 22, 34, 20];
UpperP := [42, 43, 26, 41, 30, 26, 37, 42, 28, 30, 36, 24, 48, 53, 38, 32, 43 +
41, 26, 24, 42, 36, 50, 38, 28, 28];
Alphabet := ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', +
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
{ L := Length(Text);
Writeln(ToStr(L)); }
Writeln(ToStr(UpperP[16]));
{ for i := 1 to L do //Round(L-(L/sqr(L)))
begin
for i2 := 0 to 25 do
begin
// Writeln('loop1');
if (PosEx(Alphabet[i2], Text, i) = i) then
for i3 := 0 to 25 do
begin
Letter := Alphabet[i2];
// Writeln(':(2');
if (Letter = Alphabet[i3]) then
begin
Writeln(Alphabet[i3]);
if (i3 = 25) then
begin
Writeln(IntToStr(UpperP[i3-1]));
IncEx(Result, UpperP[i3-1]);
end else begin
IncEx(Result, UpperP[i3]);
Writeln(IntToStr(UpperP[i3]) + ': ' + Alphabet[i3]);
end;
break;
end;
if (Letter = lowercase(Alphabet[i3])) then
begin
Writeln(Alphabet[i3]);
IncEx(Result, LowerP[i3]);
continue;
end;
end;
end;
end; }
end;
WHY IS Q = 84 WHEN IT'S SET AT 43, I EVEN TRIED SetLength! :angry::angry:
Note: The code doesn't matter right now - if you have anything to say, please let it be about my issue and not about the format of the function. That'll be fixed later.

Narcle

2011-12-05 19:27:16

LowerP := [24, 33, 16, 33, 24, 27, 37, 34, 12, 25, 31, 20, 36, 26, 24, 33, 31 +
15
, 20, 21, 24, 20, 28, 22, 34, 20];
UpperP := [42, 43, 26, 41, 30, 26, 37, 42, 28, 30, 36, 24, 48, 53, 38, 32, 43 +
41
, 26, 24, 42, 36, 50, 38, 28, 28];

Look at bold closely. You forgot something.

DeSnob

2011-12-05 19:35:56

From: Narcle
LowerP := [24, 33, 16, 33, 24, 27, 37, 34, 12, 25, 31, 20, 36, 26, 24, 33, 31 +
15
, 20, 21, 24, 20, 28, 22, 34, 20];
UpperP := [42, 43, 26, 41, 30, 26, 37, 42, 28, 30, 36, 24, 48, 53, 38, 32, 43 +
41
, 26, 24, 42, 36, 50, 38, 28, 28];

Look at bold closely. You forgot something.


UpperP and LowerP are used seperately. In fact, lowerp wasn't even used, and the only thing i did was debug. Other than that, the last 3 hours I've spent making this function work are making me a little crazy.

Narcle

2011-12-05 19:39:56

From: DeSnob
UpperP and LowerP are used seperately. In fact, lowerp wasn't even used, and the only thing i did was debug. Other than that, the last 3 hours I've spent making this function work are making me a little crazy.


Lol your adding the numbers together in the array. You forgot a ,

Edit:
Hence 41 + 43 = 84
I'm a magician.

DeSnob

2011-12-05 20:08:01

From: Narcle
Lol your adding the numbers together in the array. You forgot a ,

Edit:
Hence 41 + 43 = 84
I'm a magician.


I saw the 41 + 43, but didn't see that I was missing a coma. My mind is all over the place. Thanks! :) Rep +