---
title: "string(fromJoules:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/energyformatter/string(fromjoules:)"
---

# string(fromJoules:)

Returns an energy string for the provided value.

## Declaration

```swift
func string(fromJoules numberInJoules: Double) -> String
```

## Parameters

- `numberInJoules`: The energy value in joules.

## Return Value

Return Value A string that combines a value and a unit string appropriate for the formatter’s locale.

## Discussion

Discussion This method converts the provided value in joules into units appropriate to the formatter’s locale.

## See Also

### Formatting Energy Strings

- [isForFoodEnergyUse](foundation/energyformatter/isforfoodenergyuse.md)
- [getObjectValue(_:for:errorDescription:)](foundation/energyformatter/getobjectvalue(_:for:errordescription:).md)
- [numberFormatter](foundation/energyformatter/numberformatter.md)
- [string(fromValue:unit:)](foundation/energyformatter/string(fromvalue:unit:).md)
- [unitString(fromJoules:usedUnit:)](foundation/energyformatter/unitstring(fromjoules:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/energyformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/energyformatter/unitstyle.md)
