Subject Re: [firebird-support] Re: Function to find substring?
Author Kjell Rilbe
shaamim_ply wrote:

> Hello friend,I guess the following code will do the work.
>
> DECLARE EXTERNAL FUNCTION SUBSTR
...
> ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf'

Thanks, but that's not what I'm after. I want something like Delphi's
Pos(SoughtString,SearchedString) which returns the position in
SearchedString where the first occurrence of SoughtString starts.

But never mind, I wrote my own UDF and tried to use it as an argument to
the built-in substring function:

substring("Field" from 1 for PosUDF('x', "Field"))

But substring doesn't seem to work with UDF calls like that. So I ended
up doing the whole thing in a UDF instead. What I actually need to do is
to convert 'Lastname, Firstname' to "Firstname Lastname". Seems to work
now, so the problem is solved.

Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64