[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4252
  • Last Modified:

String Position Function

Firebird apparently does not have a function to find one string inside another. How do I implement this? I have the Free_UDF library (FBUDF.dll) loaded into Firebird.

Example: How would you implement this type of SQL statement:
select email, pos('@',email) PE from table
0
jmcglothlin
Asked:
jmcglothlin
1 Solution
 
gskoczylasSenior Software DeveloperCommented:
There are two possible solutions. You can create selectable stored procedure and use build-in 'SUBSTRING(s from 1 for N)' to locate substring.

Another solution is using external function (User Defined Functions). It isn't hard task to write such UDF library with Delphi (or other language). On the page http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_udf_libs there are many UDF libraries. Some of them probably include such function (e.g. http://www.udf.adhoc-data.de/index_eng.html).
0
 
Nick UpsonPrincipal Operations EngineerCommented:
if you just want to know if one string contains another you can use "if (str1 CONTAINS(str2)) then" in a stored procedure

0
 
jmcglothlinAuthor Commented:
I will use the AdHoc UDF library - thanks much
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now