Subject | Re: [firebird-support] Anyway to extract a filename from a string |
---|---|
Author | Milan Babuskov |
Post date | 2010-12-02T17:13:38Z |
SoftTech wrote:
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
==================================
> Inside a stored procedure I have a complete path to a file K:\ProgramIt is. Find the last \ and then SUBSTRING from that position to the end.
> Files\CollectingIT\Payout.mrg and would like to extract just the file name
> Payout.mrg.
>
> Is this possible?
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
==================================