Use this function to search a text string and return the first position of any character found within a specified set of characters. The search is not case sensitive.
CFind (String, Charset, Integer)
Parameter |
Description |
String |
Enter a valid string. This is the string that is searched. The default is the value of the current field text. |
Charset |
Enter a set of one or more characters, any of which may be found in the target string. |
Integer |
Enter zero (0) for a left to right search. Enter one (1) for a right to left search. The default is zero (0). |
The system returns a zero (0) if none of the search characters are found in the text string.
The default search order is left to right. You can also specify a right to left search order. Both search methods returns the position relative to the first (left-hand) character of the string parameter.
Here are some examples:
(Assume the current field contains the text Your Name.)
Function |
Result |
Explanation |
Return(CFind ("This is the answer", "ws")) |
4 |
Searching from left to right, s was first found at position 4. |
Return(CFind ("This is the answer", "ws", 1)) |
16 |
Searching from right to left, w was first found at position 16. |
Return(CFind ( , "n")) |
6 |
The first occurrence of an n in the current field Your Name is at position 6. Note the search is not case sensitive. |
Return(CFind( , "xz")) |
0 |
Neither x nor z is contained in the current text field. |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.