🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.pascal
Article #92922

Dynamiczne Tablice SetLength

#92922
From: Winetou
Date: Fri, 25 Sep 2009 17:34
39 lines
1988 bytes
Witam,

Potrzebuję zamienić Stringa na tablicę Liczb Integer. Napisałem do tego 
funkcję przy użyciu SetLength ale ciągle dostaję błąd w lazarusie 
"Project raised exeption class 'Unknow'." oraz po kliknięciu przycisku 
OK ładne okienko z kodem assemblera. Błąd otrzymuję w linii, w której 
próbuję wpisać wartość do tabeli.

procedure TmainForm.StrToPoints(content: string; var values: TIntegerArray);
var
    licz: Integer;
    count: Integer;
    temp: string;
begin
    count := 0;
    temp := '';
    for licz := 0 to Length(content) - 1 do begin
       if (content[licz] <> ' ') and (content[licz] <> ',') then temp := 
temp + content[licz]
       else if (temp <> '') then begin
          SetLength(values, count + 1);
          values[count] := StrToInt(temp);
          temp := '';
          count := count + 1;
       end;
    end;
    if (temp <> '') then begin
       SetLength(values, count + 1);
       values[count] := StrToInt(temp);
    end;
end;

błąd wyskakuje w linii values[count] := StrToInt(temp); podczas 
pierwszego jej wywołania.

Mógłby mi ktoś zasugerować gdzie popełniłem błąd ?

Pozdrawiam,
Łukasz W.
Technical Details
Message-ID: <h9iv0e$bg7$1@mx1.internetia.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!news.internetia.pl!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!news.internetia.pl!not-for-mail
From: Winetou <lw_winnetou@poczta.onet.pl>
Newsgroups: pl.comp.lang.pascal
Subject: Dynamiczne Tablice SetLength
Date: Fri, 25 Sep 2009 19:34:39 +0200
Organization: Netia S.A.
Lines: 39
Message-ID: <h9iv0e$bg7$1@mx1.internetia.pl>
NNTP-Posting-Host: 77-253-0-7.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: mx1.internetia.pl 1253900110 11783 77.253.0.7 (25 Sep 2009 17:35:10 GMT)
X-Complaints-To: abuse@inetia.pl
NNTP-Posting-Date: Fri, 25 Sep 2009 17:35:10 +0000 (UTC)
X-Tech-Contact: usenet@internetia.pl
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
X-Server-Info: http://www.internetia.pl/news/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit