<div dir="ltr"><div>Andreas,</div><div><br></div><div>I think you're looking for: lpad("my_number",n - length("my_number"),0) <br></div><div><br></div><div>Math<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 12, 2017 at 3:02 PM, Neumann, Andreas <span dir="ltr"><<a href="mailto:a.neumann@carto.net" target="_blank">a.neumann@carto.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hi,</p>
<p>Is there a way in a QGIS expression to format numbers with leading zeros up to n places before the decimal point? E.g. 1 should be 00001, 10 should be 00010, etc.</p>
<p>I would need this for correct sorting.</p>
<p>I know, I could probably write a python expression, or something complicated with CASE WHEN, but I'd like to avoid that.</p>
<p>Perhaps something is already existing?</p><span class="HOEnZb"><font color="#888888">
<p>Andreas</p>

</font></span></div>
<br>______________________________<wbr>_________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br></blockquote></div><br></div>