A
Antoine Junod
Hello,
I definitely have a problem to build a clean data structure. I would be
very happy if some of you could help me as well as in the past.
Here is my problem:
-> I have a list of keywords.
-> I would like to link each keyword with a string.
-> I should be able to access the string of a given keyword via that
keyword.
-> I should have the ablity to know if a keyword is in the list of my
keywords
A way to link a string with a keyword is to define an enumeration with
my keywords and index an array of char[] with these keywords.
But that solution does not seem to permit to know if a given keyword is
in my enumeration or not. Am I wrong with that?
I could also define a structure with a field "keyword" and a field
"string". Then I could build an array of that structure. With that
solution I would be able to search trough the table if a given keyword
is in my list of defined keywords with a simple for loop. But in that
case I'm no more able to access directly a string via its keyword. And I
think that is not really smart to build an enumeration with my keywords
to index my structure... too much repetitions.
Does someone has a better idea than me?
Thanks a lot for your help
-AJ
I definitely have a problem to build a clean data structure. I would be
very happy if some of you could help me as well as in the past.
Here is my problem:
-> I have a list of keywords.
-> I would like to link each keyword with a string.
-> I should be able to access the string of a given keyword via that
keyword.
-> I should have the ablity to know if a keyword is in the list of my
keywords
A way to link a string with a keyword is to define an enumeration with
my keywords and index an array of char[] with these keywords.
But that solution does not seem to permit to know if a given keyword is
in my enumeration or not. Am I wrong with that?
I could also define a structure with a field "keyword" and a field
"string". Then I could build an array of that structure. With that
solution I would be able to search trough the table if a given keyword
is in my list of defined keywords with a simple for loop. But in that
case I'm no more able to access directly a string via its keyword. And I
think that is not really smart to build an enumeration with my keywords
to index my structure... too much repetitions.
Does someone has a better idea than me?
Thanks a lot for your help
-AJ