WordPosition ( text ; searchWord ; start ; occurrence )
Rate this function: Average rating: 2.5 (28 votes) Discuss this Custom Function
Daniele Raybaudi, ACI
www.aci.it
Returns the word number of the searchWord in the text.
Sample Input:
| WordPosition ( "this may be or may be not the best way" ; "be" ; 1 ; 2 ) |
|
Sample Output:
|
Description:
WordPosition custom function
Author
Daniele Raybaudi
Type
Recursive
Format
WordPosition ( text ; searchWord ; start ; occurrence )
Parameters
text - any text field, or an expression that returns a reference to a text field.
searchWord - the word to search in the text
start - the word number that you want to start from
occurrence - the occurrence of the word that you want to find
Data type returned
number
Description
Returns the word number of the searchWord in the text.
In the same way that the Position function provides the number of a character position in a text string, WordPosition calculates the word number of a text string.
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
This is my Custom Function and I want to
edit it
Discuss:Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:
|
Newest Custom Functions:
| 1. |
ListToggle ( InList ; InValue ) |
| |
(Thu, May 16, 6:59pm) |
| 2. |
VatFormat ( vat ) |
| |
(Tue, May 14, 2:45am) |
| 3. |
CheckVatBE ( vat ) |
| |
(Tue, May 14, 2:32am) |
| 4. |
CheckIBAN (IBAN ) |
| |
(Tue, May 14, 2:24am) |
| 5. |
OrcidCheckDigit ( Orcid_id ; Result ; Iterations ) |
| |
(Wed, May 08, 1:44am) |
| 6. |
DateRangeBySpan ( Begin ; End ; Term) |
| |
(Mon, May 06, 6:53am) |
| 7. |
Convert_Arabic_to_Chinese( number ) |
| |
(Thu, May 02, 6:10am) |
| 8. |
NPVV ( cashFlowList, interestRate ) |
| |
(Sun, Apr 28, 1:56pm) |
 |
|
The script does not work properly when the third parameter>1. Take the example above:
WordPosition ( "this may be or may be not the best way" ; "be" ; 2;1 )
return 4;
When the third parameter is 3, 4, 5, ... the result is 5, 6, 7,...
It seems to me there are probably two solutions for it (1) write a subCF, which is recursive and takes 5 parameters: the fifth will be constant number equal to the initial third parameter; (2) the easy solution, delete the third parameter and make it default value 1.
Lizhe Xu, East Lyme, CT
August 26, 2009 7:29am