FIND
Syntax
FIND {{obj_txt_lit|_var|_col}|{date_var|_col}} IN {{src_txt_var|_col}|{date_var|_col}} {start_int_lit|_var} dst_location_int_var
Description
Determines the location of a character sequence within a string.
FIND searches the specified string for a character sequence and, if the string is found, returns its location as an offset from the beginning of the specified string. If the sequence is not found, FIND returns –1 in dst_location_int_var.
You must specify an offset from which to begin the search and supply a numeric variable for the return of the location.
If the source or search object is a date variable or column, it is converted to a string before the search according to the following rules:
-
For DATETIME columns and SQR DATE variables, SQR uses the format specified by the SQR_DB_DATE_FORMAT setting.
If this has not been set, SQR uses the first database-dependent format as listed in the Default Database Formats table.
-
For DATE columns, SQR uses the format specified by the SQR_DB_DATE_ONLY_FORMAT setting.
If this has not been set, SQR uses the format listed in the DATE Column Formats table.
-
For TIME columns, SQR uses the format specified by the SQR_DB_TIME_ONLY_FORMAT setting.
If this has not been set, SQR uses the format as listed in the TIME Column Formats table.
Parameters
| Parameter | Description |
|---|---|
|
{obj_txt_lit|_var|_col}|{date_var|_col} |
Specifies a text variable, column, or literal that is to be sought in src_txt_var|_col. |
|
{src_txt_var|_col}| {date_var|_col} |
Specifies a text variable or column to be searched. |
|
start_int_lit|_var |
Specifies the starting location of the search. |
|
dst_location_int_var |
Specifies the returned starting location of the leftmost character of the matching text in {src_txt_var|_col| date_var|_col }. |
Example
The following example illustrates the FIND command:
find 'aw.2' in &code5 0 #loc
find ',' in &name 0 #comma_loc
if #comma_loc = -1
...comma not found...
See The instr function described
in the Miscellaneous Functions table under the LET command
See EXTRACT
See The PRINT command for information
about default date and time formats