StringTrimRight
La funzione taglia caratteri di avanzamento di linea, gli spazi e le schede nella parte destra della stringa fino al primo simbolo significativo. La stringa viene modificata nel posto.
int StringTrimRight(
string& string_var
);
|
Parametri
string_var
[in][out] La stringa che viene tagliata dalla destra.
Valore restituito
Esempio:
void OnStart()
{
//--- definire la stringa sorgente con sei spazi a destra
string text="All spaces on the right will be removed from this string ";
//--- Visualizzare la stringa sorgente nei log
PrintFormat("Source line:\n'%s'", text);
//--- rimuovere tutti gli spazi a destra e visualizzare il numero di caratteri rimossi e la stringa risultante nei 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);
/*
Risultato
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'
*/
}
|
Vedi anche
StringTrimLeft, StringToLower, StringToUpper