Solved

LineBreak Code

Posted on 1999-01-12
8
244 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
Comment Utility
Hi itsyou,

Thought it was #13#10.

Hope this helps
:O)
0
 
LVL 5

Expert Comment

by:heathprovost
Comment Utility
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
Comment Utility
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
 
LVL 3

Expert Comment

by:philipleighs
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 10

Expert Comment

by:viktornet
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now