FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
No, desde luego, mucho mejor así.
|
#2
|
|||
|
|||
Hola A todos,
Soy muy malo en el tema de caracteres a string y viceversa con mod y TIntger, assign, etc. Alguien sabe si hay (y donde) un codigo en Delphi Basico que dado un pais y la antigua Cuenta me devuelva el IBAN completo? Un ejemplo Ficticio: Pais: ES, CCC: 2010 1234 19 2102365120 = ES7420101234192102365120 Desde ya, muchisimas gracias. |
#3
|
|||
|
|||
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; |
#4
|
||||
|
||||
Por favor, no olvides usar las etiquetas para código, ejemplo:
|
#5
|
||||
|
||||
Tu código con la etiqueta DELPHI:
|
#6
|
|||
|
|||
Perdón No sabía que existía esta formalidad... Es muy buena... Gracias por informarme.
Última edición por Casimiro Notevi fecha: 26-07-2020 a las 18:08:14. |
#7
|
||||
|
||||
Pues ya lo sabes
|
|
|
|