Solved

LineBreak Code

Posted on 1999-01-12
8
245 Views
Last Modified: 2010-04-06
Hi,
how is the LineBreak Code in the TMemo Component ?
It seems so if #13 isn't enough. I've written a
replace function. Now I want to remove all Line Breaks
from the Memo1.Text.
0
Comment
Question by:ItsMe
8 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 0 total points
ID: 1356143
Hi itsyou,

Thought it was #13#10.

Hope this helps
:O)
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1356144
The actual line break can be #13, #10, #13#10, or #10#13 depending on the file type.  The presence of either or both of the characters will cause a line break.  You have to remove all accurances of either character.

Heath
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1356145
for i := 1 to Length(Memo.Text) do
  if (Memo.Text[i] = #13) or (Memo.Text[i] = #10) then
    Memo.Text[i] := #8;

Do you think #8 would delete it?

-Viktor
--Ivano
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 3

Expert Comment

by:philipleighs
ID: 1356146
or like this:

var s: string;
begin
s := Memo.Text;
while Pos(#13#10, s) > 0 do
  begin
    Delete(s, Pos(#13#10, s), 2);
  end;
Memo.Text := s;


0
 
LVL 10

Expert Comment

by:viktornet
ID: 1356147
philipleighs, as heath proposed there might be cases when #13, #10, #10#13, or #13#10 are present so you need to know which one to use... the best way is to check for all the cases...
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1356148
I'm not so sure about your assertion vik and heath.
I have a file where each line is separated by #10 only.

In code I go:

var s: string;
begin
  Memo1.Lines.LoadFromFile('the file');
  s := Memo1.Text;

Looking at s in the debugger I notice that each #10 has been replaced by a #13#10 pair.

I have not tried the other combinations of #13 and #10 above, but I'm pretty sure that you'll see the same auto-conversion going on.

Cheers,
Phil.

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1356149
well if you do this,,,

Memo1.Text := 'Whatever' + #10#13 + 'Whatever2';

then you'll see that there is a new line also and oyu cannot be sure which way it is represented.....
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1356150
Maybe you should try out your suggestion. It would appear that you *don't* get a linebreak, instead you see two vertical bars (the ones that represent control chars) between whatever and whatever2 on the same line.

This just reaffirms my standing that the only possible line break in memo.text is #13#10.

Regards
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question