?
Solved

LineBreak Code

Posted on 1999-01-12
8
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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