Promotic
WikipediaLinkedInYoutubeTwitterFacebook

InstrRev - function of language VBScript

Description:
Returns the position of an occurrence of one string within another, from the end of string.
Syntax:
InstrRev(string1 As String, string2 As String, [start As Integer], [compare As Integer]) As Integer
Calling:
n = InstrRev(string1, string2[, start[, compare]])
Parameters:
string1(String) String expression being searched
string2(String) String expression searched for
start[optional] (Integer) Numeric expression that sets the starting position for each search. If omitted, -1 is used, which means that the search begins at the last character position.
compare[optional] (Integer) Numeric value indicating the kind of comparison to use when evaluating substrings. If omitted, a binary comparison is performed.
vbBinaryCompare - perform a binary comparison
vbTextCompare - perform a textual comparison
Return Values:
0 - string1 is zero-length or string2 is not found or start > Len(string2)
Null - string1 or string2=Null
start - string2 is zero-length
position at which match is found - string2 is found within string1
Note:
The syntax for the InstrRev function is not the same as the syntax for the InStr function.
Example:
Dim SearchString, SearchChar, nPos
SearchString ="XXpXXpXXPXXP"
SearchChar = "P"
nPos = InstrRev(SearchString, SearchChar, 10, 0) 'a binary comparison starting at position 10, returns 9
nPos = InstrRev(SearchString, SearchChar, -1, 1) 'a textual comparison starting at the last position, returns 12
nPos = InstrRev(SearchString, SearchChar, 8) 'a binary comparison, returns 0
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice