<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UTF8Span/isKnownASCII",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s8UTF8SpanV12isKnownASCIISbvp"
  },
  "title" : "isKnownASCII"
}
-->

# isKnownASCII

Returns whether contents are known to be all-ASCII. A return value of
`true` means that all code units are ASCII. A return value of `false`
means there *may* be non-ASCII content.

```
var isKnownASCII: Bool { get }
```

## Discussion

ASCII-ness is checked and remembered during UTF-8 validation, so this
is often equivalent to is-ASCII, but there are some situations where
we might return `false` even when the content happens to be all-ASCII.

For example, a UTF-8 span generated from a `String` that at some point
contained non-ASCII content would report false for `isKnownASCII`, even
if that String had subsequent mutation operations that removed any
non-ASCII content.

> Complexity: O(1)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)