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

# string(fromValue:unit:)

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

## Declaration

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

## Parameters

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

## Return Value

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

## See Also

### Formatting Length Strings

- [isForPersonHeightUse](foundation/lengthformatter/isforpersonheightuse.md)
- [getObjectValue(_:for:errorDescription:)](foundation/lengthformatter/getobjectvalue(_:for:errordescription:).md)
- [numberFormatter](foundation/lengthformatter/numberformatter.md)
- [string(fromMeters:)](foundation/lengthformatter/string(frommeters:).md)
- [unitString(fromMeters:usedUnit:)](foundation/lengthformatter/unitstring(frommeters:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/lengthformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/lengthformatter/unitstyle.md)
