Find function

Syntax

Find(string, within_string [, number])

Description

Use the Find function to locate one string of text within another string of text and returns the character position of the string as an integer. Find is case-sensitive and does not allow wildcards.

If you need to do either case-sensitive search or pattern matching, just to find if a string matches a pattern, use the DBPatternMatch function.

If you need to find a quotation mark, you need to escape it with a single ". For example

&find = Find("""", PSOPRDEFN_SRCH.OPRID);

Parameters

Parameter Description

string

The text you are searching for.

A tilde character ( ~ ) used in the string parameter stands for an arbitrary number of white spaces.

within_string

The text string you are searching within.

number

The position of within_string at which you want to start your search. If you omit number, Find starts at the first character of within_string.

Returns

Returns a Number value indicating the starting position of string in within_string.

Find returns with 0 if string does not appear in within_string, if number is less than or equal to zero, or if number is greater than the length of within_string.

Example

In the following example, the first statement returns 1; the second statement returns 6.

&POS = Find("P", "PeopleSoft")
&POS = Find("e", "PeopleSoft", 4)