Ver Mensaje Individual
  #1  
Antiguo 25-06-2017
rafaelon rafaelon is offline
Miembro
 
Registrado: sep 2010
Posts: 29
Reputación: 0
rafaelon Va por buen camino
problema Función verificar imei (luhn)

buenas tardes tengo la siguiente consulta tengo esta función

Código:
function IMEIcheck(imei : string): string;
var
  a : Integer;
  sum : Integer;
  i : Integer;
  d : string;
  ds : Integer;
begin
  a := 0;
  sum := 0;
  for i := 0 to Length(imei)-1 do
  begin
    d := Copy(imei, Length(imei)-i, 1);
    ds := StrToInt(d);
    if a mod 2 = 0 then
      ds := ds * 2;
    if ds > 9 then
      ds := ds - 9;
    sum := sum + ds;
    a := a + 1;
  end;
  sum := sum mod 10;
  Result := IntToStr(10 - sum);
end;
y basicamente quiero que tome el valor de imei de un Edit.text y el codigo de verificacion lo muestre en otro edit pero no se que hago mal

Código:
var
s:string;
numero:integer;

begin
numero:= StrToInt(frm_principal.edit10.Text);
s:= IMEIcheck('numero');
edit11.Text:=s;
end;
Responder Con Cita