Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
BenAmy #1
ColdFusion Structure
How to search the following structure of arrays for a user-provided string and
return the key and array position of the match, if any.
<cfscript>
teams = StructNew();
teams.basketball =
ListToArray("Heat,Jazz,Lakers,Celtics,Spurs,Piston s,Pacers,Bulls,Nets,Knicks",
",") teams.football =
ListToArray("Giants,Colts,Bengals,Bears,Dolphins,F alcons,Buccaneers,49ers,Bronco
s,Rams", ","); teams.baseball = ListToArray("Reds,Braves,Cardinals,Cubs,White
Sox,Red Sox,Yankees,Mets,Mariners,Diamondbacks", ","); teams.hockey =
ListToArray("Red Wings,Blackhawks,Avalanche,Blues,Thrashers,Lightni ng,Maple
Leafs", ","); </cfscript>
Please help me in this regard
Thanks
Amy
BenAmy Guest
-
Class::Struct - want to access structure within structure
I want to access a structure within a structure. Below is what I had in mind. Please help. #!/perl/bin/perl use Class::Struct; struct Step... -
Add to Structure
I'm a structures newbie. I need to know how to 1) Determine if a structure already exists 2) If not, create it. If yes, add to it. I've got... -
Class v. Structure
Is there any performance considerations for a web service returning a structure versus an instance of a class? -
W3D structure...
Hi My big problem is that I have some deformations that are already defined by vertices index, and their moves... But these deformations are... -
what is this data structure?
Hi, I don't know how to work with this data structure: my @array = ((a => 'appple'), (b => 'tree'), (c => 'chair')); when I do: -
JJBBDD #2
Re: ColdFusion Structure
<cfset sought="Celtics">
<cfloop collection="#teams#" item="itm">
<cfloop from="1" to="#arrayLen(teams[itm])#" index="idx">
<cfif sought eq #teams[itm][idx]#>
<cfset myIndex = idx>
<cfset myStrVal = itm>
</cfif>
</cfloop>
</cfloop>
<cfdump var="#variables#">
i tired to post this a second ago. hmm. anyway, should help. another thought
is to stick with an embedded structure and use the StructFind() function for
the whole thing. (but watch for dupes with this method)
ps: you're missing a ; in your script
JJBBDD Guest



Reply With Quote

