<div dir="ltr">On Mon, Jan 9, 2012 at 13:17, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com">pascaldragon@googlemail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p><br>
Am 09.01.2012 12:08 schrieb "ik" <<a href="mailto:idokan@gmail.com" target="_blank">idokan@gmail.com</a>>:</p><div><div class="h5"><br>
><br>
> Hello,<br>
><br>
> I'm trying to use the Format function to pad a number like so:<br>
> 01<br>
> where the original value is "$1".<br>
><br>
> I tried to do the following:<br>
><br>
> writeln(Format('%02X', [$1]));<br>
> writeln(Format('%0:2X', [$1]));<br>
> writeln(Format('%:2X', [$1]));<br>
><br>
> All of them created the following output:<br>
> " 1"<br>
><br>
> What am I doing wrong ?</div></div><p></p>
<p>You tried nearly everything except %.2X :)</p>
<p>See also the examples here: <a href="http://www.freepascal.org/docs-html/rtl/sysutils/format.html" target="_blank">http://www.freepascal.org/docs-html/rtl/sysutils/format.html</a></p></blockquote><div><br>Thanks. It's a bit difference then C and few other languages :(<br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p> </p>
<p>Regards,<br>
Sven</p>
<br>_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br></blockquote></div><br></div>