troubleshooting Question

test for end of line not working

Avatar of ibanja
ibanja asked on
6 Comments1 Solution184 ViewsLast Modified:

I have a large amount of text files that are all of the same basic format that I want to convert to HTML.  One characteristic of these files is that they were typed into a text editor by a typist who didn't understand the concept of text wrapping (these are old documents).  

The upshot is that every line has a carriage return.  

If I can ignore the carriage returns on all but the ones that are at the beginning of the line the documents will format with little coding effort. My problem is that I am unable to determine where these carriage returns are.  I have been looking for "\n".  I must be missing something.

Any help on this would be greatly appreciated.

Below is the code I am stumped on:


  for(string::iterator iter = cppString.begin() ; iter != cppString.end() ; iter++)
        case ' ':
          htmline+= " ";
        case '<':
          htmline+= "&lt;";
        case '>':
          htmline+= "&gt;";
        case '\t':
          htmline+= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        case '\n':
          if (iter == cppString.begin() )
            htmline+= "<p>\n";
            htmline+= " \n";
          htmline+= *iter;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros