Forum: Object-Pascal / Delphi-Language
Delphi
by Union,
19. Sep 2011
Ok, my solution works only for hex :(
Forum: Object-Pascal / Delphi-Language
Delphi
by Union,
19. Sep 2011
Oder kürzer Or shorter:
function ctoi(source: char): integer;
begin
result := StrToInt('$'+source);
end;
function itoc(source: integer): char;
begin
c := Format('%x', );
end;
Forum: Object-Pascal / Delphi-Language
Delphi
by Union,
19. Sep 2011
Yes this was for PChar (see StrCopy). But the principle was to show the StrToInt() and Ord() function's results.
Forum: Object-Pascal / Delphi-Language
Delphi
by Union,
19. Sep 2011
StrCopy(s, 'C++');
i := Ord(s); -> 67
i := StrToInt(s); -> Invalid since 'C' is no number
Forum: Object-Pascal / Delphi-Language
Delphi
by Union,
18. Sep 2011
This is not directly possible using a Delphi for, since OP doesn't support increments or decrements other than 1. Either use while / repeat construct or calculate the for range as well as all values derived from the counter.