I am not aware of any function which can directly meet your requirements. You probably will need to come up with a logic to do so. The functions that you can use to come up with your logic have already been listed by fellow users above. Another function that you might find useful maybe INDEXW, it finds the index of the first alphabet of the string being searched in the given mother-string.
A lot of possible logical designs can be thought of to achieve what you are after. Following is a logic using INDEXW and SCAN.
mystring='First Second Third';
n= 2 ** (indexw(mystring,'Second') - 3);
Do i=1 to n;
if scan(mystring,i) = 'Second' then myindex=i;
end;
The logic is simple, I find the starting point of the word in question, in this case it is 7. So there are 6 positions before it and I try to find out the number of possible words that can fit there. The 6th position should be blank and the 1st position should not be blank, remaining all positions may either be blank or be filled with alphabets, so the number of possible words = 2^(7-3), and I scan all words in this range.
A better logic might be achieved with the use of INDEXW, COUNTC, SUBSTR and SCAN. Assumption input string would not start with a space.
mystring=COMPBL(mystring);
mystring1=SUBSTR(mystring,1,INDEXW(mystring,'Second'));
myindex=COUNTC(mystring1,' ') + 1;
Counting the number of spaces to find out the number of words.
Loads of other methods possible, if this suites you or you get a better mthod, please let us know.