3.5.7.28 MatchEndMatchEnd-func
Description
This function finds a string pattern find$ within another string within$ starting from the specified position StartPos, and returns an integer corresponding to the ending position of find$ in within$. This function allows the wildcard characters "*" and "?".
Syntax
int MatchEnd(within$, find$ [, StartPos, Case])
NOTE: Order of string arguments is reverse of MS Excel's Search and Find functions.
Parameters
within$
- is the containing string.
find$
- is the string pattern you want to find.
StartPos
- [optional] integer that specifies the position of the character at which to start the search. The default value is 1, which means to find from the first character.
Case
- [optional] integer that specifies whether the function is case sensitive or not. The default value is 0 or false, which means the function is not case sensitive unless n is set to 1.
Return
If the string pattern has been found, return the ending position of the string pattern.
If the string pattern has not been found, return -1.
Note 1: When using wildcards ? and *, MatchEnd returns the index for the first non-wildcard character (see second Example, below).
Note 2: MatchEnd does not support searches for raw characters ? or *. To search a string for ? or *, use the Search function (which does not support wildcards).
Example
string str1$ = "From: test@Originlab.com";
string str2$ = "From*@";
int position = MatchEnd(str1$,str2$,1);
position = ; //should return 11
int position = MatchEnd("search inside this string","in?");
position=; //should return 9
See Also
MatchBegin,
Search,
Find
|