ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) |
(B) |
(I/B) |
(B) |
Description
This predefined function is used to search for a character string inside another character string.
Warning: This function distinguishes lower case from upper case characters.
Syntax
|
Result = &SEARCH(String;Searched string) |
or |
Result = &SEARCH(String;Searched string;Length) |
Parameters
|
Description |
Contents |
Controls |
Result |
Variable or array of numeric integers. |
Position of the string searched for in the initial string. If the result is an array, each element will contain a position of the string sought. If the search is unsuccessful, the result is equal to zero (if the result is an array, each element of the array is reset to zero). |
|
String |
Alphanumeric variable or constant. |
Character string in which the search is to be performed. |
Mandatory parameter. |
Searched string |
Alphanumeric variable or constant. |
Character string to be searched for in the initial string. When the parameter Length is not given, the search is applied over the whole length of the variable. |
Mandatory parameter. |
Length |
Strictly positive numeric integer constant or variable. |
Number of characters taken into account in the parameter Searched string. The number of characters must be lower than or equal to the variable or constant Searched string. |
Optional parameter. |
Example
STRING = 'HARDIS International'
STRING_TOSEARCH = 'I'
POSITION = &SEARCH(STRING;STRING_TOSEARCH)
*
* The POSITION is equal to: 5
*
* If the result is an array:
POSIT_ARR = &SEARCH(STRING;STRING_TOSEARCH)
*
* POSIT_ARR(1) = 5and POSIT_ARR(2) = 8
* (the third i is in lower case mode, it is not the searched character I)
*
STRING_TOSEARCH = 'Interactive'
POSITION = &SEARCH(STRING;STRING_TOSEARCH)
*
* The POSITION is equal to: 0 (not found)
*
POSITION = &SEARCH(STRING;STRING_TOSEARCH;5)
*
* The POSITION is equal to: 8 ("Inter" was found)
List of predefined functions by topic