[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

LineBreak Code

Posted on 1999-01-12
8
Medium Priority
?
258 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 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