<cfset map = StructNew()>
<cfset map["http://www.yahoo.com";] = "Something">

<cfoutput>#map["http://www.yahoo.com"]#</cfoutput>

Will work. You're just forced to use [] rather than . notation.

Adrian

-----Original Message-----
From: Brad Wood [mailto:[EMAIL PROTECTED]
Sent: 02 February 2006 18:12
To: CF-Talk
Subject: RE: Coldfusion hash-map


Not sure this is a true "HashMap" but it would replicate your example.
One caveat would be that your struct name would always have to be a
valid cold fusion variable.

If "a" and "b" are more likely to be "http://www.yahoo.com"; then this
approach won't work. 

I would recommend a two-dimensional array.

~Brad

<cfscript>
        map = structNew();

        map["a"] = 1;
        map["b"] = 2;
</cfscript>

<cfloop list="#structKeyList(map)#" index="key">
        <a href="#map[key]#">#map[key]#</a>
</cfloop>

Response just typed into this email, watch out for syntax omissions and
errors and all the usual caviats. 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231157
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

Reply via email to