Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Que hace esta función en VB? (https://www.clubdelphi.com/foros/showthread.php?t=49184)

mqm 15-10-2007 19:42:59

Que hace esta función en VB?
 
Tengo la siguiente función desarrollada en VB y necesito pasarla a Delphi:
-----------------------------------------------------
cadena:="43274893174817841747819273894718978277417AQW13748179"
strAux = ""
ReDim arrB(0 To (Len(cadena) / 2) - 1)
For i = 0 To (Len(cadena) / 2) - 1
strAux = Mid(cadena, i * 2 + 1, 2)
arrB(i) = CByte(Val("&H" + strAux))
Next
auxbiFIR = arrB
------------------------------------------------------
Que se supone que estan haciendo con ella, que tipo de conversión estan realizando y como podria implementarla en delphi?

cHackAll 15-10-2007 20:30:15

Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var
 cadena, strAux: string;
 arrB: array[0..1023] of Byte;
 i: Cardinal;
begin
 cadena := '43274893174817841747819273894718978277417AQW13748179';
// ReDim arrB(0 To (Len(cadena) / 2) - 1) // Asigna el espacio en memoria de la mitad de la cadena desde el índice 0
 for i := 0 To (Length(cadena) div 2) - 1 do
  begin
   strAux := Copy(cadena, i * 2 + 1, 2);
   arrB[i] := StrToInt('$' + strAux);
  end;
// auxbiFIR = arrB
Sleep(0);
end;

0j0: el Val del VB convierte a 'QW' como 0


La franja horaria es GMT +2. Ahora son las 13:38:28.

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