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