rincewind666

asked on

# Show numbers in column as numbers in row

I have something like the following in a listbox:

39003,11104,41725,13592,40151,98743,81428,29743,69623

5,3,7,3,5,7,7,2,5

2661,9433,3701,4899,5647,4700,5409,2843,2021

Using the above figures, I need the following added to another listbox:

39003,5,2661

11104,3,9433

41725,7,3701

13592,3,4899

40151,5,5647

98743,7,4700

81428,7,5409

29743,2,2843

69623,5,2021

Please note that a number is taken from each column of the first set of numbers and added to the bottom set in a row, separated by commas.

I am using Delphi 6. Your help is greatly appreciated. Thanks.

39003,11104,41725,13592,40

5,3,7,3,5,7,7,2,5

2661,9433,3701,4899,5647,4

Using the above figures, I need the following added to another listbox:

39003,5,2661

11104,3,9433

41725,7,3701

13592,3,4899

40151,5,5647

98743,7,4700

81428,7,5409

29743,2,2843

69623,5,2021

Please note that a number is taken from each column of the first set of numbers and added to the bottom set in a row, separated by commas.

I am using Delphi 6. Your help is greatly appreciated. Thanks.

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

Thommy, you never frees the dynamic TStringlist s1, and then if a day someone decides to use a number of columns different than 3 it shouldn't work

ASKER

Many thanks for your help.

ListBoxConvert.dpr

Unit1.pas

Unit1.dfm