Board index » delphi » 2 dimensional array of string and integer

2 dimensional array of string and integer


2005-07-15 01:30:01 AM
delphi65
Hi,
I have, what I thought, was a trivial question however I am not quite
sure of an answer yet. I'd like a two dimensional array of strings
and integers. The first "column" will be string and the second "column"
will be integer. I also thought about using a record to accomplish this
but I am not sure about how to go about that either. I need a
relationship between the string and integer in the columns. For
instance I'd like to declare it like so...
TMyRecord: record;
col1: string;
col2: integer;
end;
array[0..3] of TMyRecord = (
(string0, integer0)
(string1, integer1)
(string2, integer2)
(string3, integer3)
);
I know the syntax here is incorrect however I am not quite sure how to
initialize the record. I'd prefer to initialize it this (above) way
instead of this:
TMyRecord: record;
col1: (string0,string1,string2,string3);
col2: (integer0,integer1,integer2,integer3);
end;
Maintaining the second method would be more difficult because of how
they r declared.
Thanks
 
 

Re:2 dimensional array of string and integer

Hoi slycaper
You should write like this:
type
TMyRecord=
record
col1: string;
col2: integer;
end;
var
atab: array[0..3] of TMyRecord =
((col1: 'alpha'; col2: 10),
(col1: 'beta'; col2: 11),
(col1: 'gamma'; col2: 12),
(col1: 'delta'; col2: 42));
Another time if you want more people to read your questions then take a
look here:
delphi.wikicities.com/wiki/Delphi_Newsgroups
 

Re:2 dimensional array of string and integer

Thanks Riki,
That's exactly what I was looking for.
I'm trying to use Outlook Express to access borlands newsgroup server
however I keep getting an access denied error when I try to post. I
don't have the same problem when posting to the microsoft news server.
Is there login information that I need?
 

Re:2 dimensional array of string and integer

Hoi slycaper
Quote
I'm trying to use Outlook Express to access borlands newsgroup server
however I keep getting an access denied error when I try to post. I
don't have the same problem when posting to the microsoft news server.
Is there login information that I need?
There are no special login to the Borland newsgroups server, it acts like
any other standard news server. It should work with MS Outlook Express, I
have seen some posters using that, but I can recommend to use a real
newsreader program like Xananews or 40tude Dialog.
What newsgroup did you try to post to? How many other messages were there
in the group? and how old were they?
Your original question fit very well to the group
"borland.public.delphi.language.delphi". This group has about thousand
postings per month.
The group "borland.public.delphi.objectpascal" went out of use long ago. Do
not tell me that you tried to use that one ;-). Read the wiki page again.
Doei Riki