These strage characters are "CR" characters and show up as little 
square boxes if put into a TMemo.
I have tested the routine below and it works if I put one of the 
lines that has a one of these CR  characters by iteself.

I therfore need to know how to stream in one line at a time and 
stram it back out to a new file after passing it through the 
"If not (Buf1.Datastring[i] in [#13,#10]) then.."
routine

Thaks

--- In [email protected], "Chris @ IT" <[EMAIL PROTECTED]> wrote:
> You need to find out what these strange characters are; then put 
them in the
> "in [xxx]" clause of the code - then it will take them out.
> 
> Chris Albert,
> Innovative Technologies.
> http://www.it.co.ke/beta
>  
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] 
On Behalf
> Of Trevor
> Sent: Wednesday, August 10, 2005 7:20 PM
> To: [email protected]
> Subject: [delphi-en] Re: CSV File export character problem
> 
> I need the lines to remain as lines. I only want the strange 
> Characters removed from the start of the line to the end;
> 
> Thanks
> 
> --- In [email protected], "Chris @ IT" <[EMAIL PROTECTED]> wrote:
> > Simplest best way always works!!
> > 
> > Use the procedure below: note that this will remove ALL CR/LF in 
> file
> > Which might not be exactly what you want; you'll end up will all 
> the data in
> > one row; if you are talking of CSV's
> > 
> > Procedure remove_cr_lf(infile,outfile : string);
> > Var
> >   Inf,outf : tfilestream;
> >   Buf1 : TStringStream;
> >   Buf2 : string;
> >   i : integer;
> > Begin
> >   Inf:=tfilestream.create(infile,fmopenread);
> >   Outf:=tfilestream.create(outfile,fmcreate);
> > 
> >   Buf1:=TStringStream.Create('');
> >   Buf1.CopyFrom(Inf,0);
> >   Inf.Free;
> > 
> >   Buf2:='';
> >   For i:=1 to length(Buf1.Datastring) do
> >     If not (Buf1.Datastring[i] in [#13,#10]) then
> >       Buf2:=Buf2+Buf1.Datastring[i];
> > 
> >   Buf1.Free;
> >   Buf1:=TStringStream.Create(Buf2);
> >   Outf.CopyFrom(Buf1,0);
> >   Buf1.Free;
> >   Outf.Free;
> > End; 
> >   
> > 
> > Ive just typed this directly in outlook; might have some bugs!
> > 
> > 
> > 
> > Chris Albert,
> > Innovative Technologies.
> > http://www.it.co.ke/beta
> >  
> > 
> > -----Original Message-----
> > From: [email protected] [mailto:delphi-
[EMAIL PROTECTED] 
> On Behalf
> > Of Trevor
> > Sent: Wednesday, August 10, 2005 6:45 PM
> > To: [email protected]
> > Subject: [delphi-en] CSV File export character problem
> > 
> > Need help in stripping out unwanted characters in a text file.
> > 
> > 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.
> > 
> > Therfore when I open the file into oa TMemo component it 
seperates 
> any 
> > line that contains one of these characters into two lines.
> > 
> > I tried reding it into a stringlist and then writing the 
> individual 
> > lines to a TMemo but that produced the same result.
> > 
> > How can I remove these characters (ie CR & LF) charaters that 
are 
> in 
> > the middle of some of the lines.
> > 
> > Thanks
> > 
> > 
> > 
> > 
> > 
> > -----------------------------------------------------
> > Home page: http://groups.yahoo.com/group/delphi-en/
> > To unsubscribe: [EMAIL PROTECTED] 
> > Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED] 
> Yahoo! Groups Links




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hopabhl/M=362131.6882499.7825260.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123701720/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/
 


Reply via email to