The sample code will need to be modified to fit your needs, but here is the next version that will filter to only elements with "data" in them.

<!---CODE--->
<cfset list = "C:\temp,C:\tmp,C:\windows,D:\data,D:\temp,D:\data\dir1,D:\data\dir1,D:\data\dir1,D:\data\dir2,D:\data\dir2,E:\temp">


<cfoutput>

<!--- Loop through all the elements in a list --->
<cfloop from="1" to="#listLen(list)#" index="i">


  <!--- Select elements that have the string "data" and
    --- output them if they are the first element or
    --- they do not match the previous element.
    --- the list must be sorted for this to work. --->
  <cfif findnocase("data",listGetAt(list, i),1) AND (i EQ 1 OR (i GT 1 AND listGetAt(list, i) NEQ listGetAt(list, i-1)))>
  
   <!--- Output elements that match criteria, format as desired. --->
   <p>#listGetAt(list,i)#</p>
   
  </cfif>
  
</cfloop>


</cfoutput>
<!---- END CODE --->
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to