Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function StrExpand(trgt_pos: Integer; s1, s2, str: string): string;
- var
- l, p, start, finish, s1L, s2L: Integer;
- tmp: string;
- begin
- Result := '';
- l := Length(str);
- s1L := Length(s1);
- s2L := Length(s2);
- if (((s1L + s2L) <= l) and (s1L > 0) and (s2L > 0) and (trgt_pos <= l) and (trgt_pos > 0)) then
- begin
- p := 0;
- start := 0;
- finish := PosEx(s2, str, trgt_pos);
- if ((finish < 1) or (finish = trgt_pos)) then
- Exit;
- tmp := Copy(str, 1, trgt_pos);
- repeat
- p := PosEx(s1, tmp, (p + 1));
- if (p > 0) then
- start := p;
- until (p <= 0);
- if ((start <> trgt_pos) and (start > 0) and (finish > 0) and (start < finish)) then
- Result := Copy(str, (start + s1L), ((finish - start) - 1));
- end;
- end;
- var
- str: string;
- begin
- str := 'C:\Simba\Includes\SPS\img\runescape_surface\air_altar_path.png';
- WriteLn(StrExpand((Length(str) - 4), '\', '.png', str));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement