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.
Declaration
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.