Guest User

Untitled

a guest
Jul 28th, 2015
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.29 KB | None | 0 0
  1. function parser(doc, home, eend: string; nacpos: integer = 0; parstype: integer
  2.   = 0): string;
  3. var
  4.   raz: integer;
  5. begin
  6.   if parstype = 0 then
  7.   begin
  8.     if ((trim(home) <> '') and (trim(eend) = '')) then
  9.     begin
  10.       result := copy(doc, posex(home, doc, nacpos) + length(home), length(doc) -
  11.         (posex(home, doc, nacpos) + length(home)) + 1);
  12.     end
  13.     else if ((trim(home) = '') and (trim(eend) <> '')) then
  14.     begin
  15.       result := copy(doc, 1, posex(eend, doc, nacpos) - 1);
  16.     end
  17.     else if ((trim(home) <> '') and (trim(eend) <> '')) then
  18.     begin
  19.       if copy(doc, posex(home, doc, nacpos) + length(home), 1) <> copy(eend, 1,
  20.         1) then
  21.       begin
  22.         raz := posex(eend, doc, posex(home, doc, nacpos) + length(home) + 1) -
  23.           posex(home, doc, nacpos) - length(home);
  24.         result := copy(doc, posex(home, doc, nacpos) + length(home), raz);
  25.       end
  26.       else
  27.         result := '';
  28.     end;
  29.   end
  30.   else if parstype = 1 then
  31.   begin
  32.     if copy(doc, posex(eend, doc, nacpos) + length(eend), 1) <> copy(home, 1, 1) then
  33.     begin
  34.       raz := posex(home, doc, nacpos) - posex(eend, doc, nacpos) - length(eend);
  35.       result := copy(doc, posex(eend, doc, nacpos) + length(eend), raz);
  36.     end
  37.     else
  38.       result := '';
  39.   end;
  40.   exit;
  41. end;
Advertisement
Add Comment
Please, Sign In to add comment