Ver Mensaje Individual
  #6  
Antiguo 25-07-2020
elmorsa elmorsa is offline
Registrado
 
Registrado: jul 2020
Posts: 5
Reputación: 0
elmorsa Va por buen camino
He conseguido hacerlo en Delphi BASICO.



Como dije antes, no tengo ni idea, o sea que esto puede ser muy malo...


Funciones para transformar pais+CCC en IBAN:


Function Modulo97(const s: string): integer;
var
v, l : integer;
alpha : string;
number : longint;
begin
v := 1;
l := 9;
Result := 0;
alpha := '';

while (v <= Length(s)) do
begin
if (l > Length(s)) then
l := Length(s);
alpha := alpha + Copy(s, v, l);
number := StrToInt(alpha);
Result := number mod 97;
v := v + l;
alpha := IntToStr(Result);
l := 9 - Length(alpha);
end;
end;


Function ControlIBAN(const cuenta, Pais: string): string;
var
i, j: integer;
m: int64;
l: Integer;
t: string;
s: string;

function LetterToDigit(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
try
t := Cuenta + Pais + '00';
s := '';
j := Length(t);
for i := 1 to j do
s := s + LetterToDigit(t[i]);
l:= Modulo97(s);
m:= int64(l);
i := 98 - m;
result := IntToStr(i);
if i < 10 then result := '0' + result;
except
result :='';
end;
end;


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