🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Dynamiczne Tablice SetLength

#92923
From: darekm
Date: Fri, 25 Sep 2009 19:45
48 lines
2271 bytes
Winetou pisze:
> 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 := 
dlaczego startujesz od zera
  sprawdz co masz w content[0]

> 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.


-- 
   Darek
Technical Details
Message-ID: <h9j6pf$qhb$1@atlantis.news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!newsfeed.neostrada.pl!nemesis.news.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mail
References: <h9iv0e$bg7$1@mx1.internetia.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!newsfeed.neostrada.pl!nemesis.news.neostrada.pl!atlantis.news.neostrada.pl!news.neostrada.pl!not-for-mail
From: darekm <darekm@emadar.com>
Newsgroups: pl.comp.lang.pascal
Subject: Re: Dynamiczne Tablice SetLength
Date: Fri, 25 Sep 2009 21:45:33 +0200
Organization: TP - http://www.tp.pl/
Lines: 50
Message-ID: <h9j6pf$qhb$1@atlantis.news.neostrada.pl>
References: <h9iv0e$bg7$1@mx1.internetia.pl>
NNTP-Posting-Host: gsi122.internetdsl.tpnet.pl
Mime-Version: 1.0
X-Trace: atlantis.news.neostrada.pl 1253908079 27179 83.3.216.122 (25 Sep 2009 19:47:59 GMT)
X-Complaints-To: usenet@news.neostrada.pl
NNTP-Posting-Date: Fri, 25 Sep 2009 19:47:59 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <h9iv0e$bg7$1@mx1.internetia.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit