Pos of Substring in String

Hi
Thanks for the String Manipulations in FB5.
It would be nice to have this (I already suggested this in the past):
like Pos in Delphi :
i := Pos(Substring, String); //find if Substring can be found in String, and return its position or 0

Daphna Levin

Hi Daphna,

Thanks for the suggestion. For what it’s worth, you can already do this in VBScript or JScript inside a script event.

VBScript:

i = InStr(String, Substring) ’ 0 if not found, or one-based index if found (same as Delphi)

JScript:

i = String.indexOf(Substring); // -1 if not found, or zero-based index if found

You can also do it without script, but it’s not pretty :slight_smile:

Steve