StringTrimRight
A função remove caracteres de quebra de linha, espaços e tabs na parte direita da string após o último símbolo significativo. A string é modificada no lugar.
int StringTrimRight(
string& string_var
);
|
Parâmetros
string_var
[in][out] String que será cortada a partir da direita.
Valor do Retorno
Exemplo:
void OnStart()
{
//--- definimos a string de origem com seis espaços no lado direito da string
string text="All spaces on the right will be removed from this string ";
//--- exibimos no log a string de origem
PrintFormat("Source line:\n'%s'", text);
//--- excluímos os espaços do lado direito e enviamos o número de símbolos excluídos e a string resultante para o log
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'
*/
}
|
Também Veja
StringTrimLeft, StringToLower, StringToUpper