[fpc-pascal] format string - number padding

2012-01-09 Thread ik
Hello, I'm trying to use the Format function to pad a number like so: 01 where the original value is $1. I tried to do the following: writeln(Format('%02X', [$1])); writeln(Format('%0:2X', [$1])); writeln(Format('%:2X', [$1])); All of them created the following output: 1 What am I doing

Re: [fpc-pascal] format string - number padding

2012-01-09 Thread Sven Barth
Am 09.01.2012 12:08 schrieb ik ido...@gmail.com: Hello, I'm trying to use the Format function to pad a number like so: 01 where the original value is $1. I tried to do the following: writeln(Format('%02X', [$1])); writeln(Format('%0:2X', [$1])); writeln(Format('%:2X', [$1])); All of

Re: [fpc-pascal] format string - number padding

2012-01-09 Thread Lubomír Čabla
Try writeln(Format('%.2x', [$1])); On Mon, Jan 9, 2012 at 12:07 PM, ik ido...@gmail.com wrote: Hello, I'm trying to use the Format function to pad a number like so: 01 where the original value is $1. I tried to do the following: writeln(Format('%02X', [$1])); writeln(Format('%0:2X',

Re: [fpc-pascal] format string - number padding

2012-01-09 Thread ik
On Mon, Jan 9, 2012 at 13:17, Sven Barth pascaldra...@googlemail.comwrote: Am 09.01.2012 12:08 schrieb ik ido...@gmail.com: Hello, I'm trying to use the Format function to pad a number like so: 01 where the original value is $1. I tried to do the following: