3 Replies Latest reply on Apr 8, 2008 10:44 AM by Newsgroup_User

    Looping over a list with a 'NP form feed, new page' character [ascii(12)]

    Level 7
      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)
      for (i=1; i <= len(report); i++)
      char = mid(report,i,1);

      if (asc(char) eq 12)
      writeOutput('<strong>[' & asc(char) & ']</strong>' & char);
      writeOutput('[' & asc(char) & ']' & char);

      If I loop over the text file delimiting on the asc(12) character, I get
      41 items rather then the expected 7.
      <cfloop list="#report#" delimiters="#asc(12)#" index="page">

      Any idea why my code is not producing consistent results?