F_FINDWORD

<< F_STRCMP U_STRCMP | IBExpert UDF Functions | F_WORDNUM >>

F_FINDWORD

 
  • compatibility to FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP

U_FINDWORD

  • function from adhoc
  • Compatible with UTF-8
  • Input VARCHAR(32760) String, in which another string is to be looked for, INTEGER Position, at which the search in the string should starts
  • Output VARCHAR(254) word or a partial word , which starts at positon parameter 2

Positioning starts with 0, that means 1.position = 0 and searches up to the first blank. returns <null> if parameter 2 < 0 or > length of parameter 1, all other cases '' (empty string).

Example

 SELECT 'ABC' AS ISCORRECT, F_FINDWORD('ABC 123 45678 9123', 0) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_FINDWORD                                                                                                                                              
 ========= ===============================================================================
 ABC       ABC       

Example

 SELECT 'BC' AS ISCORRECT, F_FINDWORD('ABC 123 45678 9123', 1) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_FINDWORD                                                                                                                                              
 ========= ===============================================================================
 BC        BC        

Example

 SELECT '123' AS ISCORRECT, F_FINDWORD('ABC 123 45678 9123', 3) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_FINDWORD                                                                                                                                              
 ========= ===============================================================================
 123       123       

Example

 SELECT '123' AS ISCORRECT, F_FINDWORD('ABC 123 45678 9123', 4) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_FINDWORD                                                                                                                                              
 ========= ===============================================================================
 123       123          

Example

 SELECT NULL AS ISCORRECT, F_FINDWORD('ABC 123 45678 9123', 20) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_FINDWORD                                                                                                                                              
 ========= ===============================================================================
 <null>    <null>         

Example

 SELECT NULL AS ISCORRECT, F_FINDWORD(NULL, NULL) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_FINDWORD                                                                                                                                              
 ========= ===============================================================================
 <null>    <null>                 

back to top of page
<< F_STRCMP U_STRCMP | IBExpert UDF Functions | F_WORDNUM >>