---
title: "substring(to:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/stringprotocol/substring(to:)"
---

# substring(to:)

Returns a new string containing the characters of the String up to, but not including, the one at a given index.

## Declaration

```swift
func substring(to index: Self.Index) -> String
```
