I’m so used to dealing with comma-delimited lists in ColdFusion that I would sometimes take a data file that had one item per line and replace the newline characters with commas.
It’s easy to use the carriage return [chr(13)] and line feed [chr(10)] characters as list delimiters, though, and remove the intermediary step. Here’s a quick example:
<cfsavecontent variable="data">
this
is
a
list
with
one
word
per
line
</cfsavecontent>
<cfoutput>
<ol>
<cfloop list="#data#" delimiters="#chr(13)##chr(10)#" index="line">
<li>#line#</li>
</cfloop>
</ol>
</cfoutput>
Which produces the following:
- this
- is
- a
- list
- with
- one
- word
- per
- line
(I can’t believe I didn’t think of this until today!)