Strings.InStrRev(String, String, Int32, CompareMethod) Yöntem
Tanım
Dizenin sağ tarafından başlayarak bir dizenin diğeri içindeki ilk oluşumunun konumunu döndürür.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);
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
Parametreler
- StringCheck
- String
Gereklidir.Required. Aranan dize ifadesi.String expression being searched.
- StringMatch
- String
Gereklidir.Required. Aranan dize ifadesi.String expression being searched for.
- Start
- Int32
İsteğe bağlı.Optional. Dizenin sol tarafından başlayarak her arama için tek tabanlı başlangıç konumunu ayarlayarak sayısal ifade.Numeric expression setting the one-based starting position for each search, starting from the left side of the string. StartAtlanırsa,-1 kullanılır, bu, aramanın son karakter konumunda başladığı anlamına gelir.If Start is omitted then -1 is used, meaning the search begins at the last character position. Arama daha sonra sağdan sola ilerler.Search then proceeds from right to left.
- Compare
- CompareMethod
İsteğe bağlı.Optional. Alt dizeleri değerlendirirken kullanılacak karşılaştırma türünü gösteren sayısal değer.Numeric value indicating the kind of comparison to use when evaluating substrings. Atlanırsa, bir ikili karşılaştırma gerçekleştirilir.If omitted, a binary comparison is performed. Değerler için bkz. ayarlar.See Settings for values.
Döndürülenler
| EğerIf | InStrRev geri dönüşlerInStrRev returns |
|---|---|
StringCheck sıfır uzunluktadır
StringCheck is zero-length | 00 |
StringMatch sıfır uzunluktadır
StringMatch is zero-length |
Start
|
StringMatch bulunamadı
StringMatch is not found | 00 |
StringMatch içinde bulunur StringCheck
StringMatch is found within StringCheck | Dizenin sağ tarafıyla başlayarak ilk eşleşmenin bulunduğu konum.Position at which the first match is found, starting with the right side of the string. |
Start uzunluğundan büyük StringMatch
Start is greater than length of StringMatch | 00 |
Özel durumlar
Start = 0 veya Start < -1.Start = 0 or Start < -1.
Örnekler
Bu örnek, işlevinin kullanımını gösterir 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)
Açıklamalar
İşlevin sözdizimi, InStrRev işlevin sözdizimi ile aynı değildir InStr .Note that the syntax for the InStrRev function is not the same as the syntax for the InStr function.
CompareBağımsız değişkeni aşağıdaki değerlere sahip olabilir.The Compare argument can have the following values.
| SabitConstant | DescriptionDescription |
|---|---|
Binary |
İkili bir karşılaştırma gerçekleştirir.Performs a binary comparison. |
Text |
Metinsel bir karşılaştırma gerçekleştirir.Performs a textual comparison. |