--- In [email protected], "Trevor" <[EMAIL PROTECTED]> wrote: > Need help in stripping out unwanted characters in a text file.
Okay, stripping... Nice. I'll help. > I exported a EXCEl spread sheet to a .csv file. I fI look at the file > in notepad all entries show up on individual lines. But on closer > inspection there are either "CR" or "LF" charcters on some lines. You mean, 0x0A or 0x0D characters. I would expect you to find 0x0D0A sequences too, since those are the EOL markers. The biggest question is of course why Excel is adding those characters to your output. Does your spreadsheet has fields that are multi-line cells? (Cells where the content has a CR or a LF?) > Therfore when I open the file into oa TMemo component it seperates any > line that contains one of these characters into two lines. Yeah, that can happen, yes... Then again, don't use a memo field to display raw CVS files. They're not meant to do that. > I tried reding it into a stringlist and then writing the individual > lines to a TMemo but that produced the same result. Yep. But again, you are trying to display the CSV in a TMemo. The TMemo is smart enough to translate those half-EOLs to full EOLs. > How can I remove these characters (ie CR & LF) charaters that are in > the middle of some of the lines. Why would you want to remove them anyway? Does it get in the way of converting your CSV data to something you want to use internally? Keep in mind that those additional characters are part of the data that you're trying to export. For some reason, your original data includes these characters. My non-professional opinion would be to just call those CSV files to be invalid since they aren't formatted correctly. The definition of the CSV format is pretty clear about that. If you want to use a format that allows linebreaks as part of the data, then export to e.g. XML instead. Just go check WHY you get those additional characters. They are disrupting your code and cause your export to become invalid. Fix the problem in Excel, not in Delphi. The problem within Delphi is of course that you never know for sure if such a linebreak is part of the data or it it's the record separator. Delphi can't guess what the real data is supposed to be. Or as my dad always says: Data in, data out. Crap in, crap out... :-) > Thanks You're welcome. With kind regards, X Katja Bergman. ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hu8l8p8/M=362131.6882499.7825260.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123707870/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org ">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy</a>.</font> --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

