Strings.Trim(String) Yöntem
Tanım
Belirtilen dizenin önünde boşluk ( LTrim ), sondaki boşluk ( RTrim ) veya başında veya sonunda boşluk () olmayan bir kopyasını içeren bir dize döndürür Trim .Returns a string containing a copy of a specified string with no leading spaces (LTrim), no trailing spaces (RTrim), or no leading or trailing spaces (Trim).
public:
static System::String ^ Trim(System::String ^ str);
public static string Trim (string? str);
public static string Trim (string str);
static member Trim : string -> string
Public Function Trim (str As String) As String
Parametreler
- str
- String
Gereklidir.Required. Herhangi bir geçerli String ifade.Any valid String expression.
Döndürülenler
Belirtilen dizenin önünde boşluk ( LTrim ), sondaki boşluk ( RTrim ) veya başında veya sonunda boşluk () olmayan bir kopyasını içeren bir dize Trim .A string containing a copy of a specified string with no leading spaces (LTrim), no trailing spaces (RTrim), or no leading or trailing spaces (Trim).
Örnekler
Bu örnek, LTrim RTrim bir dize değişkeninden sondaki boşlukları park etmek için öndeki boşlukları ve işlevi eklemek için işlevini kullanır.This example uses the LTrim function to strip leading spaces and the RTrim function to strip trailing spaces from a string variable. TrimHer iki boşluk türünü de atmak için işlevini kullanır.It uses the Trim function to strip both types of spaces.
' Initializes string.
Dim testString As String = " <-Trim-> "
Dim trimString As String
' Returns "<-Trim-> ".
trimString = LTrim(testString)
' Returns " <-Trim->".
trimString = RTrim(testString)
' Returns "<-Trim->".
trimString = LTrim(RTrim(testString))
' Using the Trim function alone achieves the same result.
' Returns "<-Trim->".
trimString = Trim(testString)
Açıklamalar
LTrim, RTrim Ve Trim işlevleri dizelerin uçlarından boşlukları kaldırır.The LTrim, RTrim, and Trim functions remove spaces from the ends of strings.