Strings.RTrim(String) Metoda
Definice
Vrátí řetězec obsahující kopii zadaného řetězce bez mezer na začátku ( LTrim ), bez mezer () RTrim nebo mezer na začátku nebo na konci ( 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 ^ RTrim(System::String ^ str);
public static string RTrim (string? str);
public static string RTrim (string str);
static member RTrim : string -> string
Public Function RTrim (str As String) As String
Parametry
- str
- String
Povinná hodnota.Required. Libovolný platný String výraz.Any valid String expression.
Návraty
Řetězec obsahující kopii zadaného řetězce bez mezer na začátku () LTrim , bez mezer () RTrim nebo mezer na začátku nebo na konci ( 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).
Příklady
Tento příklad používá LTrim funkci k obložení úvodních mezer a RTrim funkce pro obložení koncových mezer z řetězcové proměnné.This example uses the LTrim function to strip leading spaces and the RTrim function to strip trailing spaces from a string variable. Používá Trim funkci pro odložení obou typů mezer.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)
Poznámky
LTrimFunkce, RTrim a Trim odeberou mezery z konců řetězců.The LTrim, RTrim, and Trim functions remove spaces from the ends of strings.