---
title: "canBeConverted(to:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/stringprotocol/canbeconverted(to:)"
---

# canBeConverted(to:)

Returns a Boolean value that indicates whether the string can be converted to the specified encoding without loss of information.

## Declaration

```swift
func canBeConverted(to encoding: String.Encoding) -> Bool
```

## Parameters

- `encoding`: A string encoding.

## Return Value

Return Value true if the string can be encoded in encoding without loss of information; otherwise, false.
