Board index » delphi » (Q) Parsing an array's position, to avoid dup's

(Q) Parsing an array's position, to avoid dup's

(Q) Parsing an array's position, to avoid dup's

I am assigning text strings to an array, and would like to read thru a file
and continually add to the array without duplication any of the string
values. Sample data would look like this...

A=1
B=2
A=3
C=4

The array I would like to create (with just simple concatenation) then would
look like this

A=1,3 | B=2 | C=3

Source below:

while not eof(input) do
   begin
   readln(Input, ReadLine);
   LineNo := LineNo + 1;
   DelimPos := Pos('=', ReadLine);
   FirstValue[LineNo] := Copy(ReadLine, 1, DelimPos - 1);
   SecondValue := Copy(ReadLine, DelimPos + 1, Length(ReadLine));

   {Your Help Goes HERE!! }

   //Listbox1.Items.Add(FirstValue[LineNo]);
   //Listbox2.Items.Add(SecondValue);
   end;
end;

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

 

Re:(Q) Parsing an array's position, to avoid dup's


Use TStrings. You can use the Name=Value capabilities to that want you want
to accomplish.

Brian

Quote
Rejec...@hotmail.com wrote in message <6ss21h$uu...@nnrp1.dejanews.com>...
>(Q) Parsing an array's position, to avoid dup's

>I am assigning text strings to an array, and would like to read thru a file
>and continually add to the array without duplication any of the string
>values. Sample data would look like this...

>A=1
>B=2
>A=3
>C=4

>The array I would like to create (with just simple concatenation) then
would
>look like this

>A=1,3 | B=2 | C=3

>Source below:

>while not eof(input) do
>   begin
>   readln(Input, ReadLine);
>   LineNo := LineNo + 1;
>   DelimPos := Pos('=', ReadLine);
>   FirstValue[LineNo] := Copy(ReadLine, 1, DelimPos - 1);
>   SecondValue := Copy(ReadLine, DelimPos + 1, Length(ReadLine));

>   {Your Help Goes HERE!! }

>   //Listbox1.Items.Add(FirstValue[LineNo]);
>   //Listbox2.Items.Add(SecondValue);
>   end;
>end;

>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Other Threads