---
title: "subscript(_:)"
framework: swift
role: symbol
role_heading: Instance Subscript
path: "swift/string/utf8view/subscript(_:)-25vyw"
---

# subscript(_:)

Accesses a view of this collection with the elements at the given indices.

## Declaration

```swift
subscript(subranges: RangeSet<Self.Index>) -> DiscontiguousSlice<Self> { get }
```

## Parameters

- `subranges`: The indices of the elements to retrieve from this collection.

## Return Value

Return Value A collection of the elements at the positions in subranges.

## Overview

Overview note: O(1)
