---
title: "string(fromValue:unit:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/massformatter/string(fromvalue:unit:)"
---

# string(fromValue:unit:)

Returns a properly formatted mass string for the given value and unit.

## Declaration

```swift
func string(fromValue value: Double, unit: MassFormatter.Unit) -> String
```

## Parameters

- `value`: The mass’s value in the given unit.
- `unit`: The unit used in the resulting mass string.

## Return Value

Return Value A localized string that combines the provided value and unit.

## See Also

### Formatting Mass Strings

- [isForPersonMassUse](foundation/massformatter/isforpersonmassuse.md)
- [getObjectValue(_:for:errorDescription:)](foundation/massformatter/getobjectvalue(_:for:errordescription:).md)
- [numberFormatter](foundation/massformatter/numberformatter.md)
- [string(fromKilograms:)](foundation/massformatter/string(fromkilograms:).md)
- [unitString(fromKilograms:usedUnit:)](foundation/massformatter/unitstring(fromkilograms:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/massformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/massformatter/unitstyle.md)
