Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   [GH Freebrary] (https://www.clubdelphi.com/foros/forumdisplay.php?f=54)
-   -   Función ghDeleteLeft (https://www.clubdelphi.com/foros/showthread.php?t=82693)

Al González 03-04-2013 21:41:28

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'


La franja horaria es GMT +2. Ahora son las 03:00:58.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi