POSITION
Returns the starting position of a substring within a string.
Syntax
POSITION(substring,string,[start,case])
Argument
Argument | Description | Default | |
---|---|---|---|
substring | The substring to locate within string. | None | |
string | The string in which to locate substring. | None | |
[start] | The column in string at which to begin searching. | 1 | |
[case] | One of the following to indicate whether case must match: | I | |
I | Ignore case. | ||
C | Case must match exactly. |
Results
Result | Description | |
---|---|---|
Return | The position of substring within string. Returns 0 if Enrichment does not find substring. | |
%%RC | One of the following: | |
-1 | start is less than or equal to | |
0 | No error | |
1 | substring is larger than string | |
2 | Size of substring is 0 | |
3 | start is larger than string | |
%%RM | A null string (''). | |
%%RV | The position of substring within string. Returns 0 if Enrichment does not find substring. |
Examples
Function Call | Return | %%RC | %%RV |
---|---|---|---|
POSITION('Total','This is a string',1,C) | 0 | 0 | 0 |
POSITION('is','This is a string',1,C) | 3 | 0 | 3 |
POSITION('IS',"This is a string, ISN'T IT?",4,I) | 6 | 0 | 6 |
POSITION('IS',"This is a string, ISN'T IT?",4,C) | 19 | 0 | 19 |