Andreas,

I think you're looking for: lpad("my_number",n - length("my_number"),0)

Math

On Wed, Jul 12, 2017 at 3:02 PM, Neumann, Andreas <[email protected]>
wrote:

> Hi,
>
> 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.
>
> I would need this for correct sorting.
>
> I know, I could probably write a python expression, or something
> complicated with CASE WHEN, but I'd like to avoid that.
>
> Perhaps something is already existing?
>
> Andreas
>
> _______________________________________________
> QGIS-Developer mailing list
> [email protected]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to