Home > Back-end >  HexStrToStr and strtohexstr two functions used in the android
HexStrToStr and strtohexstr two functions used in the android

Time:09-22

D7 before write desktop applications used in HexStrToStr and strtohexstr two functions
 function HexStrToStr (const S: string) : string; 
//hexadecimal string into a string
Var
T: Integer;
Ts: the string;
M, Code: Integer;
The begin
T:=1;
Result:=';
While t<=Length (S) do
The begin
While not (S [t] in [' 0 '... '9', 'A'. The 'F', 'A'. The 'F']) do
Inc (t);
If (t + 1 & gt; Length (S)) or (not (S (t + 1] in [' 0 '... '9', 'A'. The 'F', 'A'. The 'F'])) then
Ts:='$' + S [t]
The else
Ts:='$' [t] + S + S (t + 1),
Val (ts, M Code);
If Code=0 then
Result: the Result=+ CRH (M);
Inc (t, 2);
end;
end;

The function StrToHexStr (const S: string) : string;
//string convert hexadecimal string
Var
I: Integer;
The begin
For I:=1 to Length (S) do
The begin
If I=1 then
Result:=IntToHex (word [1] (S), 2)
Else the Result: the Result +="' + IntToHex (word [I] (S), 2);
end;
end;

Now want to should be how to write in the android can use
  • Related