Autor Beitrag
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: Do 17.09.09 10:07 
Hallo Delphi-Forum!

Ich habe da mal wieder eine Frage:
Wie kann man in einem Memo einen Text-Teil finden, von dem man nicht weiß, ob er denn diesmal wieder dazwischen einen Zeilenumbruch hat? Ansonsten kann ich ihn ja einfach so finden:
ausblenden Delphi-Quelltext
1:
SelPos := Pos(FindText, MemoHTML.Lines.Text);					
Geht das denn auch mit Sternchen, statt dem Leerzeichen?

Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Do 17.09.2009 um 12:26
Moderiert von user profile iconNarses: Überflüssige Zeilenumbrüche/Leerzeilen entfernt.


Zuletzt bearbeitet von ffgorcky am Fr 22.03.13 01:31, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 17.09.09 12:28 
Moin!

Ansatz: Entferne alles unterhalb #32 aus dem Text und #32#32 durch #32, bis keine Ersetzung mehr möglich ist. Dann hast du den Text "normalisiert". Jetzt kannst du darin suchen, ohne dich um den Zeilenumbruch kümmern zu müssen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
ffgorcky Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: Sa 19.09.09 11:12 
Wie mache ich das denn?
ich dachte bisher so in etwa mit:
ausblenden Delphi-Quelltext
1:
bearbeiteterString.replace(#13#10,'');					

Was meinst Du das denn mit der #32?
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Sa 19.09.09 11:48 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Function ZapWhiteSpaces (Const aString : String) : String;
Var
  n : Integer;
  c : Char;

Begin
  SetLength (Result, Length (aString));
  n := 0;
  for c in aString do
// Entweder kein Leer- oder Steuerzeichen, oder wenn es eins ist,
// darf das Zeichen davor keins sein. Das 'n>0' ist wichtig, weil
// sonst auf Result[0] zugegriffen würde => Peng.
    if (c > ' 'or ((n > 0and (Result[n] <> ' ')) then begin
      Inc(n);
      Result[n] := c;
    end;
  SetLength (Result, n);                                
End;

_________________
Na denn, dann. Bis dann, denn.