Question
Looping over a list with a 'NP form feed, new page' character [ascii(12)]
I have a text file that I am trying to loop over using the
"NP form
feed, new page" character. The ultimate goal is to output this text
file as a PDF with <cfdocument...> replacing that ASCII(12) character
with <cfdocumentitem type="pagebreak"/> tags.
If I output the text file character by character I count 6 ascii(12)
characters.
<pre>
<cfscript>
for (i=1; i <= len(report); i++)
{
char = mid(report,i,1);
if (asc(char) eq 12)
writeOutput('<strong>[' & asc(char) & ']</strong>' & char);
else
writeOutput('[' & asc(char) & ']' & char);
}
</cfscript>
</pre>
If I loop over the text file delimiting on the asc(12) character, I get
41 items rather then the expected 7.
<cfoutput>
<pre>
<cfloop list="#report#" delimiters="#asc(12)#" index="page">
#page#
<hr/>
</cfloop>
</pre>
</cfoutput>
Any idea why my code is not producing consistent results?
feed, new page" character. The ultimate goal is to output this text
file as a PDF with <cfdocument...> replacing that ASCII(12) character
with <cfdocumentitem type="pagebreak"/> tags.
If I output the text file character by character I count 6 ascii(12)
characters.
<pre>
<cfscript>
for (i=1; i <= len(report); i++)
{
char = mid(report,i,1);
if (asc(char) eq 12)
writeOutput('<strong>[' & asc(char) & ']</strong>' & char);
else
writeOutput('[' & asc(char) & ']' & char);
}
</cfscript>
</pre>
If I loop over the text file delimiting on the asc(12) character, I get
41 items rather then the expected 7.
<cfoutput>
<pre>
<cfloop list="#report#" delimiters="#asc(12)#" index="page">
#page#
<hr/>
</cfloop>
</pre>
</cfoutput>
Any idea why my code is not producing consistent results?
