---
title: "escaped(asASCII:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/unicode/scalar/escaped(asascii:)"
---

# escaped(asASCII:)

Returns a string representation of the Unicode scalar.

## Declaration

```swift
func escaped(asASCII forceASCII: Bool) -> String
```

## Parameters

- `forceASCII`: Pass true if you need the result to use only ASCII characters; otherwise, pass false.

## Return Value

Return Value A string representation of the scalar.

## Discussion

Discussion Scalar values representing characters that are normally unprintable or that otherwise require escaping are escaped with a backslash. let tab = Unicode.Scalar(9)! print(tab) // Prints " " print(tab.escaped(asASCII: false)) // Prints "\t" When the forceASCII parameter is true, a Unicode.Scalar instance with a value greater than 127 is represented using an escaped numeric value; otherwise, non-ASCII characters are represented using their typical string value. let bap = Unicode.Scalar(48165)! print(bap.escaped(asASCII: false)) // Prints "밥" print(bap.escaped(asASCII: true)) // Prints "\u{BC25}"

## See Also

### Printing and Displaying a Scalar

- [description](swift/unicode/scalar/description.md)
- [write(to:)](swift/unicode/scalar/write(to:).md)
- [utf16](swift/unicode/scalar/utf16.md)
- [Unicode.Scalar.UTF16View](swift/unicode/scalar/utf16view.md)
- [debugDescription](swift/unicode/scalar/debugdescription.md)
- [customMirror](swift/unicode/scalar/custommirror.md)
- [customPlaygroundQuickLook](swift/unicode/scalar/customplaygroundquicklook.md)
