|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Best way to create cflist of unique words from long text
Please advice function or steps to start putting together one.Walter Conti 05/06/08 05:20 P Walter Conti wrote:Ian Skinner 05/06/08 05:31 P >Walter Conti wrote:Walter Conti 05/06/08 06:32 P http://www.bennadel.com/blog/432-Using-ColdFusion-Structures-To-Remove-Duplicate-List-Values.htmDaniel Roberts 05/08/08 10:57 A Please advice function or steps to start putting together one. Thank you. Walter Conti wrote: > Please advice function or steps to start putting together one. > Thank you. Create a structure with the words as the keys. Since a structure can have only one key of any given value, any duplicates will be consolidated. You can then use structKeyList() if you truly need a list. Also an easy way to count word if desired. ----- Excess quoted text cut - see Original Post for more ----- Great! Thank You Ian. http://www.bennadel.com/blog/432-Using-ColdFusion-Structures-To-Remove-Duplicate-List-Values.htm * <!--- Create a structure to hold the movie titles. ---> * <cfset objMovies = StructNew() /> * * <!--- Loop over the list to add mappings to the struct. ---> * <cfloop index="strMovie" list="#lstMovies#" delimiters=","> * * <!--- * Store key/value pair. In this case, we don't * really care about the value (hence storing "" * as value). We only care about the key. * ---> * <cfset objMovies[ strMovie ] = "" /> * * </cfloop> * * <!--- Convert the now unique key values into a list. ---> * <cfset lstMovies = StructKeyList( objMovies ) />
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||