Reduce decimals in var

I have an item:
Number ElectricalCost2 “Electrical cost [%.2f Kr]”

In a rule I put the value in a var that I mail
var doorbellmessage = “El Konsumption=”+ ElectricalCost2.state as DecimalType
sendMail(“”, “Dagens Energi Kostnad”, doorbellmessage, attachmentUrlList)

This works fine, but in the recieved mail i got to many decimals
El Konsumption=37.3544887500Kr

How can I reduce the number of decimals to 2 in the var/mail?

Try this:

var doorbellmessage = String.format("El Konsumption=%.2f Kr", ElectricalCost2.state as DecimalType)

It did not work, I got the error message:

Rule ‘Reset Cost 2’: f != org.eclipse.smarthome.core.library.types.DecimalType

(ElectricalCost2.state as DecimalType).floatValue

Thanks, it worked

[quote=“String.format(“El Konsumption=%.2f Kr”, (ElectricalCost2.state as DecimalType).floatValue)”]