Strings.Right(String, Int32) Yöntem
Tanım
Dizenin sağ tarafından belirtilen sayıda karakter içeren bir dize döndürür.Returns a string containing a specified number of characters from the right side of a string.
public:
static System::String ^ Right(System::String ^ str, int Length);
public static string Right (string? str, int Length);
public static string Right (string str, int Length);
static member Right : string * int -> string
Public Function Right (str As String, Length As Integer) As String
Parametreler
- str
- String
Gereklidir.Required. String en sağdaki karakterlerin döndürüldüğü ifade.String expression from which the rightmost characters are returned.
- Length
- Int32
Gereklidir.Required. Integer.Integer. Kaç karakter dönebileceğinizi gösteren sayısal ifade.Numeric expression indicating how many characters to return. 0 ise, sıfır uzunluklu bir dize ("") döndürülür.If 0, a zero-length string ("") is returned. İçindeki karakter sayısından büyük veya ona eşitse str , tüm dize döndürülür.If greater than or equal to the number of characters in str, the entire string is returned.
Döndürülenler
Dizenin sağ tarafından belirtilen sayıda karakter içeren bir dize.A string containing a specified number of characters from the right side of a string.
Özel durumlar
Length<0.Length < 0.
Örnekler
Bu örnek, Right belirli bir alt dizeyi döndürmek için işlevinin kullanımını gösterir String .This example demonstrates the use of the Right function to return a substring of a given String. Özelliği olan bir sınıfta Right , işlevi tamamen nitelendirmek gerekebilir Right .In a class that has a Right property, it may be necessary to fully qualify the Right function.
Dim testString As String = "Hello World!"
' Returns "World!".
Dim subString As String = Right(testString, 6)
Açıklamalar
İçindeki karakter sayısını öğrenmek için str Len işlevini kullanın.To determine the number of characters in str, use the Len function. Bir Windows formunda veya özelliğine sahip başka bir sınıfta kullanılıyorsa, Right işlevi ile tam olarak nitelemeniz gerekir Microsoft.VisualBasic.Strings.Right .If used in a Windows Form, or any other class that has a Right property, you must fully qualify the function with Microsoft.VisualBasic.Strings.Right.
Not
RightBVisual Basic önceki sürümlerindeki işlev, karakterler yerine bayt cinsinden bir dize döndürür.The RightB function in earlier versions of Visual Basic returns a string in bytes, rather than characters. Esas olarak çift baytlı karakter kümesi (DBCS) uygulamalarında dize dönüştürmek için kullanılır.It is used primarily for converting strings in double-byte character set (DBCS) applications. Tüm geçerli Visual Basic dizeleri Unicode ve RightB artık desteklenmiyor.All current Visual Basic strings are in Unicode, and RightB is no longer supported.