StringTrimRight

Supprime les symboles de retour chariot, les espaces et les tabulations à la fin de la chaîne. La chaîne est modifiée selon la place.

int  StringTrimRight(
   string&  string_var      // chaîne à couper
   );

Paramètres

string_var

[in][out]  La chaîne de caractères, qui sera coupée à droite.

Valeur de Retour

Retourne le nombre de symboles coupés.

Exemple :

void OnStart()
  {
//--- définit la chaîne source avec six espaces à droite
   string text="All spaces on the right will be removed from this string      ";
//--- affiche la chaîne source dans le journal
   PrintFormat("Source line:\n'%s'"text);
//--- supprime tous les espaces à droite et affiche le nombre de caractères supprimés et la chaîne résultante dans le journal
   int num=StringTrimRight(text);
   PrintFormat("The StringTrimRight() function removed %d chars from the right side. Now the line looks like this:\n'%s'"numtext);
   
  /*
  Résultat
   Source line:
   'All spaces on the right will be removed from this string      '
   The StringTrimRight() function removed 6 chars from the right sideNow the line looks like this:
   'All spaces on the right will be removed from this string'
  */
  }

Voir aussi

StringTrimLeft, StringToLower, StringToUpper