[QGIS-Developer] Expression question: formatting a decimal nr to a defined format

Neumann, Andreas a.neumann at carto.net
Thu Jun 22 07:53:31 PDT 2017


Hi, 

In a QGIS expression I wanted to format a decimal nr to a fixed format:
4 digits (with leading zeros) before the decimal point and then a fixed
3 decimal places with trailing zeros if necessary. 

e.g. 

4.5 should become 0004.500 

78.45 should become 0078.450 

Is there an existing expression function for that or would I have to
create my own custom Python expression using the format() method in
Python? 

Thanks, 

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170622/5dbffcb2/attachment.html>


More information about the QGIS-Developer mailing list