Cedric --
As you said, CF structures don't support case-sensitive keynames. Alternatives
might include representing the structure
as a case-sensitive XML document object or, if your structure keynames will
never be anything other than the single
characters you showed in your example, you could use
test[asc(keyname)] = value;
Thus, test.a would become test[asc('a')] and test.A would become
test[asc('A')], clearly two different keys.
If the keynames might be longer than a single character, one could imagine many
other schemes that would hash, or map,
the keynames into unique values to be used as substitute keynames. For
example, each character in the keyname could be
replaced by its asc() code translated to a 4-digit hexadecimal string. (I
guess 4 hex digits are needed now (instead of
the 2 digits that would have sufficed in the pre-Unicode era) since the Java
UCS-2 character set used by CF gives values
for asc() up to 65535.) Another example would be to maintain the set of
keynames as a simple CF list and then use the
position of the keyname in the list as the substitute keyname in the structure.
One would just have to be careful to
search the list with ListFind() instead of ListFindNoCase().
-- Larry Afrin
Medical University of South Carolina
Cedric Villat wrote:
> So I guess CF doesn't support case-sensitive keys in a structure. For
> example, given the following code:
>
> test = StructNew();
> test.a = 5;
> test.A = 10;
>
> I would have hoped that 2 keys would have been made, "a" and "A", but
> instead only 1 key is made, and has a value of 10. Is there anyway to have
> CF use case-sensitive keys so that I could do something like the above to
> get 2 keys?
>
> Thanks,
> Cedric
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195838
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54