Ver Mensaje Individual
  #6  
Antiguo 12-07-2004
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 29
Lepe Va por buen camino
La funcion Format nunca la habia usado así, lo que si tengo a mano son estas 2 funciones que vienen con las Rxlibs en la unidad nkStrs. Si no recuerdo mal eran originarias de las NKLibs que han ido quedando algo obsoletas.

Código Delphi [-]
function PadLeft(const cStr: String; ch: char; iLen: Integer): String;
begin
  if Length(cStr) >= iLen then
    Result := Copy(cStr, 1, iLen)
  else
    Result := StringOfChar(ch, iLen - Length(cStr)) + cStr;
end (*PadLeft*);

function PadRight(const cStr: String; ch: char; iLen: Integer): String;
begin
  if Length(cStr) >= iLen then
    Result := Copy(cStr, 1, iLen)
  else
    Result := cStr + StringOfChar(ch, iLen - Length(cStr));
end (*PadRight*);

Ejemplo:
Código Delphi [-]
   Padright(telefono,'-', 15);  //8354128--------
   PadLeft(telefono,'-',15);   //--------8354128

Saludos
Responder Con Cita