[Lazarus] How can I increment/decrement a alphanumeric value?

silvioprog silvioprog at gmail.com
Sat Aug 21 15:55:09 CEST 2010


  Em 21/08/2010 10:49, Wildfire escreveu:
>> http://freepascal.org/docs-html/rtl/strutils/dec2numb.html
>> http://freepascal.org/docs-html/rtl/strutils/numb2dec.html
>
> Silvio, read the links, those two functions provide exactly what you 
> want (use BASE 36)

Wow, perfectly correct,

procedure IncrementHex(var HexS: string);
begin
   HexS := dec2numb(numb2dec(HexS, 36) + 1, 3, 36);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
   S: string;
begin
   S := Edit1.Text;
   IncrementHex(S);
   Edit2.Text := S;
end;

Yes, thanks mens :)

Silvio Clécio




More information about the Lazarus mailing list