Solved

Need Help in Strings Replacing

Posted on 2003-12-02
3
208 Views
Last Modified: 2010-04-05
hi I would like some help with this.

I need a memo1.text

I need all the spacings in the example below looking like
before
Fla Flo, D E L T H I     yyyy
after
FlaFlo,DELTHIyyyy

I also need memo1.text lines sorting so that there are no more lines just 1 line
before
Fla Flo, D E L T H I     yyyy
Fla Flo, D E L T H I     yyyy
Fla Flo, D E L T H I     yyyy
after
Fla Flo, D E L T H I     yyyyFla Flo, D E L T H I     yyyyFla Flo, D E L T H I


could anyone help me?
0
Comment
Question by:Eolaz
[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
3 Comments
 
LVL 8

Expert Comment

by:gmayo
ID: 9858286
var s1, s2 : string;
i, j : integer;
found : boolean;

s1 := 'Fla Flo, D E L T H I     yyyy';
s2 := '';
for i := 1 to Length(s1) do if s1[i] > #32 then s2 := s2 + s1[i];

for i := memo1.Lines.Count - 1 downto 0 do begin
  s1 := memo1.Lines[i];
  found := false;
  for j := 0 to i - 1 do begin
    if memo1.Lines[j] = s1 then found := true;
  end;
  if found then memo1.Lines.Delete(i);
end;

Geoff M.
0
 
LVL 2

Accepted Solution

by:
cqhall earned 20 total points
ID: 9858518
Another approach...

Remove spaces:
  memo1.lines.text:=stringreplace(memo1.lines.text,' ','',[rfReplaceAll]);

Remove CR/LF:
 memo1.lines.text:=stringreplace(memo1.lines.text,#13#10,'',[rfReplaceAll]);
0
 

Author Comment

by:Eolaz
ID: 9858648
Doh! I'd forgot about that rfreplaceAll, silly me lol, I left that part blank, no wonder it didn't work. lol

thxs for reminding me cqhall
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 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