Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 17-11-2011
Avatar de thelibmx
thelibmx thelibmx is offline
Miembro
 
Registrado: mar 2007
Posts: 515
Poder: 18
thelibmx Va por buen camino
Wink Rellenar Strings con caracteres

Pues para las nuevas generaciones va

function LPad(S: String; Ch: Char; Len: Integer): String;
begin
Result := StringOfChar(Ch, Len - Length(S)) + S;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
e2.text:=(LPad(e1.text,'0',10));
end;
__________________
En movimiento...
Responder Con Cita
  #2  
Antiguo 17-11-2011
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
bueno quiza ya fue respondida la pregunta....
pero aqui les envio lo que yo hago

Código Delphi [-]
 
function Llenar(strValue: String; intNewWidth: Integer): String;
var intOldWidth, I: Integer;
begin
  try
    strValue := Trim (StrValue);
    if strValue = '' then
      strValue := '0';
    if StrToInt(strValue) < 0 then
      strValue := '0';
  except
    on EConvertError do strValue := '0';
  end;
  intOldWidth := Length(strValue);
  if intOldWidth < intNewWidth then
    for I := 1 to intNewWidth - intOldWidth do
      strValue := '0' + strValue;
  Result := strValue;
end;


para llamarlo

Código Delphi [-]
 
  edtNumIngreso.Text := Llenar(edtNumIngreso.Text, 11);
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 14:03:36.


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
Copyright 1996-2007 Club Delphi