MemberKeyDictionary with String as unique key and blanks
Posted: Fri Aug 07, 2009 12:17 pm
by JensRichnow >> Wed, 4 Dec 2002 22:21:07 GMT
Hi, I just encountered a problem which puzzled me in the sense that I did not see it before I upgraded to the last consolidated patch. Or maybe it is an intended feature!? In the code snippet below the MKD has a MemberShip of Variable and is keyed on the variableName (String). Key is unique, no duplicates allowed. Now, if I try to add variables to the dict whereby the name differs in the the length of spaces, I get a 1310 (Key already used ...). I'm not sure how the key is implemented if it is a string, but I (wrongly) assumed that strings are made of characters which have a ASCII value, etc. Therefore an empty string should be different to a string containing one space which should be different to a string made of five space, etc.
Am I wrong in this assumption?
vars var1 :Variable;
var2 :Variable;
dict :VariablesByUniqueNames;
begin
app.initialiseApplication();
create dict transient;
create var1 transient;
var1.setVariableName("");
create var2 transient;
var1.setVariableName(" ");
dict.add(var1);
dict.add(var2);
app.finaliseApplication();
epilog
dict.purge();
delete dict;
end;
Hi, I just encountered a problem which puzzled me in the sense that I did not see it before I upgraded to the last consolidated patch. Or maybe it is an intended feature!? In the code snippet below the MKD has a MemberShip of Variable and is keyed on the variableName (String). Key is unique, no duplicates allowed. Now, if I try to add variables to the dict whereby the name differs in the the length of spaces, I get a 1310 (Key already used ...). I'm not sure how the key is implemented if it is a string, but I (wrongly) assumed that strings are made of characters which have a ASCII value, etc. Therefore an empty string should be different to a string containing one space which should be different to a string made of five space, etc.
Am I wrong in this assumption?
vars var1 :Variable;
var2 :Variable;
dict :VariablesByUniqueNames;
begin
app.initialiseApplication();
create dict transient;
create var1 transient;
var1.setVariableName("");
create var2 transient;
var1.setVariableName(" ");
dict.add(var1);
dict.add(var2);
app.finaliseApplication();
epilog
dict.purge();
delete dict;
end;