StringTrimLeft

Borra los símbolos de salto de línea, espacios y símbolos de tabulación desde el inicio de la cadena hasta el primer símbolo significativo. Cadena se modifica en el lugar.

int  StringTrimLeft(
   string&  string_var      // cadena para recortar
   );

Parámetros

string_var

[in][out]  Cadena que será recortada por la izquierda.

Valor devuelto

Devuelve el número de símbolos cortados.

Ejemplo:

void OnStart()
  {
//--- definimos la cadena de origen con seis espacios a la izquierda
   string text="      All spaces on the left will be removed from this string";
//--- Mostramos la cadena de origen en el registro
   PrintFormat("Source line:\n'%s'"text);
//--- eliminamos todos los espacios a la izquierda y mostramos en el registro el número de caracteres eliminados y la cadena resultante
   int num=StringTrimLeft(text);
   PrintFormat("The StringTrimLeft() function removed %d chars from the left side. Now the line looks like this:\n'%s'"numtext);
   
   /*
   Resultado
   Source line:
   '      All spaces on the left will be removed from this string'
   The StringTrimLeft() function removed 6 chars from the left sideNow the line looks like this:
   'All spaces on the left will be removed from this string'
   */
  }

Véase también

StringTrimRight, StringToLower, StringToUpper