StringTrimRight
Borra los símbolos de salto de línea, espacios y símbolos de tabulación desde el último símbolo significativo hasta el final de la cadena. Cadena se modifica en el lugar.
int StringTrimRight(
string& string_var
);
|
Parámetros
string_var
[in][out] Cadena que será recortada por la derecha.
Valor devuelto
Ejemplo:
void OnStart()
{
//--- definimos la cadena de origen con seis espacios a la derecha
string text="All spaces on the right will be removed from this string ";
//--- Mostramos la cadena de origen en el registro
PrintFormat("Source line:\n'%s'", text);
//--- eliminamos todos los espacios a la derecha y mostramos en el registro el número de caracteres eliminados y la cadena resultante
int num=StringTrimRight(text);
PrintFormat("The StringTrimRight() function removed %d chars from the right side. Now the line looks like this:\n'%s'", num, text);
/*
Resultado
Source line:
'All spaces on the right will be removed from this string '
The StringTrimRight() function removed 6 chars from the right side. Now the line looks like this:
'All spaces on the right will be removed from this string'
*/
}
|
Véase también
StringTrimLeft, StringToLower, StringToUpper