Ver Mensaje Individual
  #1  
Antiguo 03-04-2013
Avatar de Al González
[Al González] Al González is offline
In .pas since 1991
 
Registrado: may 2003
Posts: 5.604
Reputación: 29
Al González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en brutoAl González Es un diamante en bruto
Función ghDeleteLeft

Elimina de una cadena de caracteres los primeros que coincidan con los caracteres especificados.

Unidad

GHFRTL

Declaración
Código Delphi [-]
  { Delete Left }
  Function ghDeleteLeft (Const Value :String; Const Chr :Char) :String;
    Overload;

  { Delete Left }
  Function ghDeleteLeft (Const Value :String; Const Chrs :TSysCharSet)
    :String; Overload;
Descripción

La función ghDeleteLeft toma una cadena de caracteres y devuelve ésta, eliminando de su extremo izquierdo todos los caracteres contiguos que coincidan con Chr o que se encuentren dentro del conjunto Chrs.

Parámetros

Value — Una cadena de caracteres cualquiera. Si es cadena vacía, el resultado también lo será.

Chr — Carácter que se desea eliminar del inicio de la cadena.

Chrs — Caracteres que se desea eliminar del inicio de la cadena, expresado como conjunto.

Nota: Si el primer carácter de Value no coincide con Chr o no pertenece al conjunto Chrs, el resultado será esa misma cadena de caracteres. La función solamente quita los caracteres coincidentes encontrados de forma ininterrumpida desde el comienzo de la cadena.

Ejemplos
Código Delphi [-]
  S := ghDeleteLeft ('______Avatar', '_');
  // S = 'Avatar'

  S := ghDeleteLeft ('???Babel', '?');
  // S = 'Babel'

  S := ghDeleteLeft ('  Pan''s Labyrinth', ' ');
  // S = 'Pan''s Labyrinth'

  S := ghDeleteLeft ('+-+-+-Invictus', ['+', '-']);
  // S = 'Invictus'

  S := ghDeleteLeft ('1945The Woman in the Window', ['0'..'9']);
  // S = 'The Woman in the Window'

  S := ghDeleteLeft ('2010|+12|148|Inception', ['|', '0'..'9']);
  // S = '+12|148|Inception'

  S := ghDeleteLeft ('2010|+12|148|Inception', ['|', '+', '0'..'9']);
  // S = 'Inception'

  S := ghDeleteLeft ('1941...Citizen Kane', ['0'..'9', '.']);
  // S = 'Citizen Kane'

  S := ghDeleteLeft ('Test', '.');
  // S = 'Test'

  S := ghDeleteLeft ('1...Test', ['2', '.']);
  // S = '1...Test'
Responder Con Cita