Returns the numeric position of a word within a string.
Syntax
WORDPOS(word,string,[start,case])
Arguments
| Argument |
Description |
Default |
| word |
The word to locate within string. Enrichment considers only the first occurrence of word in string, and ignores leading and trailing blanks. |
None |
| string |
The string in which to locate word. |
None |
| [start] |
The number (greater than 0) of the word in string with 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 numeric position of word within string. Returns 0 if Enrichment does not find word. |
| %%RC |
One of the following: |
| |
-1 |
start is less than or equal to 0. |
| |
0 |
No error. |
| |
1 |
start not found. |
| |
2 |
word is blank. |
| |
3 |
word not found. |
| %%RM |
A null string (''). |
| %%RV |
The character position in string at which word begins. |
Examples
| Function Call |
Return |
%%RC |
%%RV |
| WORDPOS('is','This is a string',1,C) |
2 |
0 |
6 |
| WORDPOS('is',' ',1,C) |
0 |
1 |
0 |