---
title: isContiguousUTF8
framework: swift
role: symbol
role_heading: Instance Property
path: swift/string/iscontiguousutf8
---

# isContiguousUTF8

Returns whether this string’s storage contains validly-encoded UTF-8 contents in contiguous memory.

## Declaration

```swift
var isContiguousUTF8: Bool { get }
```

## Discussion

Discussion Contiguous strings always operate in O(1) time for withUTF8, always give a result for String.UTF8View.withContiguousStorageIfAvailable, and always return a non-nil value from String._utf8Span and String.UTF8View._span. Contiguous strings also benefit from fast-paths and better optimizations.

## See Also

### Working with Encodings

- [availableStringEncodings](swift/string/availablestringencodings.md)
- [defaultCStringEncoding](swift/string/defaultcstringencoding.md)
- [localizedName(of:)](swift/string/localizedname(of:).md)
- [makeContiguousUTF8()](swift/string/makecontiguousutf8().md)
- [withUTF8(_:)](swift/string/withutf8(_:).md)
