StringTrimLeft
Supprime les symboles de retour chariot, les espaces et les tabulations du début de la chaîne jusqu'au premier symbole significatif. La chaîne est modifiée selon la place
int StringTrimLeft(
string& string_var
);
|
Paramètres
string_var
[in][out] La chaîne de caractères, qui sera coupée à partir de la gauche.
Valeur de Retour
Exemple :
void OnStart()
{
//--- définit la chaîne source avec six espaces à gauche
string text=" All spaces on the left will be removed from this string";
//--- affiche la chaîne source dans le journal
PrintFormat("Source line:\n'%s'", text);
//--- supprime tous les espaces à gauche et affiche le nombre de caractères supprimés et la chaîne résultante dans le journal
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);
/*
Résultat
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'
*/
}
|
Voir aussi
StringTrimRight, StringToLower, StringToUpper