Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros temas > Trucos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Los mejores trucos

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 10-05-2008
Troffed Troffed is offline
Miembro
 
Registrado: mar 2004
Posts: 51
Poder: 21
Troffed Va por buen camino
Cálculo de los dígitos IBAN

Requiere la librería DFF: http://www.delphiforfun.org/programs/Library/Default.htm

Código Delphi [-]
{ ——
Devuelve el código IBAN que corresponde con la cuenta y el país que se le pasa
Ver http://www.desarrolloweb.com/articulos/2484.php y http://www.sima.cat/chkiban.php
—— }
function ControlIBAN(const Cuenta, Pais: string): string;
var
  i, j: integer;
  m: int64;
  l: TInteger;
  t: string;
  s: string;

  function LetterToDigit(const C: Char): string;
  const
    a: char = ‘A’;
  var
    d: byte;
  begin
    result := C;
    if C in [‘A’..‘Z’] then
    begin
      d := (byte(C) – byte(a)) + 10;
      result := IntToStr(d);
    end;
  end;

begin
  l := TInteger.Create;
  try
    t := Cuenta + Pais + ‘00’;
    s := ‘’;
    j := Length(t);
    for i := 1 to j do
      s := s + LetterToDigit(t[i]);
    l.Assign(s);
    l.Modulo(97);
    l.ConvertToInt64(m);
    i := 98 – m;
    result := IntToStr(i);
    if i < 10 then result := ‘0’ + result;
  finally
    l.Free;
  end;
end;

function FormateaIBAN(const Cuenta, Pais: string): string;
begin
  result := Pais + ControlIBAN(Cuenta, Pais) + Cuenta;
end;
Responder Con Cita
 



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 16:44:18.


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