Subject Re: [firebird-support] Anyway to extract a filename from a string
Author Milan Babuskov
SoftTech wrote:
> Inside a stored procedure I have a complete path to a file K:\Program
> Files\CollectingIT\Payout.mrg and would like to extract just the file name
> Payout.mrg.
>
> Is this possible?

It is. Find the last \ and then SUBSTRING from that position to the end.
From the top of the head (spath is input string):

declare p integer;
declare q integer;
q = 1;
p = -1;
while (q <= char_length(spath)) do
begin
if (substring(spath from q for 1) = '\') then p = q;
end

if (p > -1) then filename = substring(spath from p+1);


--
Milan Babuskov

==================================
The easiest way to import XML, CSV
and textual files into Firebird:
http://www.guacosoft.com/xmlwizard
==================================