Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#4

Re: Memo Box Content kürzen

  Alt 28. Feb 2006, 06:16
Guten Morgen.

Wenn die Beobachtung von Lars korrekt ist, dann hilft dir vielleicht das hier weiter:

Delphi-Quellcode:
function After(const subStr, s: String; occurence: Integer = 1): String;
var
  index: Integer;
begin
  index := 1;
  while (occurence > 0) and (index > 0) do
  begin
    index := {StrUtils.}PosEx(subStr, s, index);
    if index > 0 then Inc(index, Length(subStr));
    Dec(occurence);
  end;
  if index = 0
    then Result := ''
    else Result := Copy(s, index, MaxInt);
end;

function Before(const subStr, s: String; occurence: Integer = 1): String;
var
  index: Integer;
begin
  index := 1;
  while (occurence > 0) and (index > 0) do
  begin
    index := {StrUtils.}PosEx(subStr, s, index);
    if index > 0 then Inc(index, Length(subStr));
    Dec(occurence);
  end;
  Result := s;
  if index > 0 then
    SetLength(Result, index - Length(subStr));
end;
Grüße vom marabu
  Mit Zitat antworten Zitat