Strings.InStrRev(String, String, Int32, CompareMethod) Metodo
Definizione
Restituisce la posizione della prima occorrenza di una stringa inclusa in un'altra a partire dalla destra della stringa.Returns the position of the first occurrence of one string within another, starting from the right side of the string.
public static int InStrRev (string StringCheck, string StringMatch, int Start = -1, Microsoft.VisualBasic.CompareMethod Compare = Microsoft.VisualBasic.CompareMethod.Binary);
static member InStrRev : string * string * int * Microsoft.VisualBasic.CompareMethod -> int
Public Function InStrRev (StringCheck As String, StringMatch As String, Optional Start As Integer = -1, Optional Compare As CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary) As Integer
Parametri
- StringCheck
- String
Obbligatorio.Required. Espressione String da cercare.String expression being searched.
- StringMatch
- String
Obbligatorio.Required. Espressione String da cercare.String expression being searched for.
- Start
- Int32
facoltativo.Optional. Espressione numerica che imposta la posizione iniziale in base 1 di ogni ricerca, a partire dal lato sinistro della stringa.Numeric expression setting the one-based starting position for each search, starting from the left side of the string. Se Start
viene omesso, viene usato -1, a indicare che la ricerca inizia dalla posizione dell'ultimo carattere.If Start
is omitted then -1 is used, meaning the search begins at the last character position. La ricerca procede quindi da destra a sinistra.Search then proceeds from right to left.
- Compare
- CompareMethod
facoltativo.Optional. Valore numerico che indica il tipo di confronto da utilizzare per la valutazione delle sottostringhe.Numeric value indicating the kind of comparison to use when evaluating substrings. Se omesso, viene eseguito un confronto binario.If omitted, a binary comparison is performed. Per informazioni sui valori, vedere "Impostazioni".See Settings for values.
Restituisce
SeIf | InStrRev restituiràInStrRev returns |
StringCheck è di lunghezza zero
StringCheck is zero-length
| 00 |
StringMatch è di lunghezza zero
StringMatch is zero-length
|
Start
|
StringMatch non trovato.
StringMatch is not found
| 00 |
StringMatch si trova all'interno di StringCheck .
StringMatch is found within StringCheck | La posizione della prima corrispondenza, iniziando dalla destra della stringa.Position at which the first match is found, starting with the right side of the string. |
Start è maggiore della lunghezza di StringMatch .
Start is greater than length of StringMatch | 00 |
Eccezioni
Start
= 0 o Start
< -1.Start
= 0 or Start
< -1.
Esempi
Questo esempio illustra l'uso della funzione InStrRev
.This example demonstrates the use of the InStrRev
function.
Dim testString As String = "the quick brown fox jumps over the lazy dog"
Dim testNumber As Integer
' Returns 32.
testNumber = InStrRev(testString, "the")
' Returns 1.
testNumber = InStrRev(testString, "the", 16)
Commenti
Si noti che la sintassi per la funzione InStrRev
non corrisponde alla sintassi per la funzione InStr
.Note that the syntax for the InStrRev
function is not the same as the syntax for the InStr
function.
L'argomento Compare
può includere i valori seguenti.The Compare
argument can have the following values.
CostanteConstant | DescriptionDescription |
---|---|
Binary |
Esegue un confronto binario.Performs a binary comparison. |
Text |
Esegue un confronto di testo.Performs a textual comparison. |