Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function parser(doc, home, eend: string; nacpos: integer = 0; parstype: integer
- = 0): string;
- var
- raz: integer;
- begin
- if parstype = 0 then
- begin
- if ((trim(home) <> '') and (trim(eend) = '')) then
- begin
- result := copy(doc, posex(home, doc, nacpos) + length(home), length(doc) -
- (posex(home, doc, nacpos) + length(home)) + 1);
- end
- else if ((trim(home) = '') and (trim(eend) <> '')) then
- begin
- result := copy(doc, 1, posex(eend, doc, nacpos) - 1);
- end
- else if ((trim(home) <> '') and (trim(eend) <> '')) then
- begin
- if copy(doc, posex(home, doc, nacpos) + length(home), 1) <> copy(eend, 1,
- 1) then
- begin
- raz := posex(eend, doc, posex(home, doc, nacpos) + length(home) + 1) -
- posex(home, doc, nacpos) - length(home);
- result := copy(doc, posex(home, doc, nacpos) + length(home), raz);
- end
- else
- result := '';
- end;
- end
- else if parstype = 1 then
- begin
- if copy(doc, posex(eend, doc, nacpos) + length(eend), 1) <> copy(home, 1, 1) then
- begin
- raz := posex(home, doc, nacpos) - posex(eend, doc, nacpos) - length(eend);
- result := copy(doc, posex(eend, doc, nacpos) + length(eend), raz);
- end
- else
- result := '';
- end;
- exit;
- end;
Advertisement
Add Comment
Please, Sign In to add comment