---
title: "substring(from:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsstring/substring(from:)"
---

# substring(from:)

Returns a new string containing the characters of the receiver from the one at a given index to the end.

## Declaration

```swift
func substring(from: Int) -> String
```

## Parameters

- `from`: An index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver. Raises an doc://com.apple.foundation/documentation/Foundation/NSExceptionName/rangeException if (anIndex - 1) lies beyond the end of the receiver.

## Return Value

Return Value A new string containing the characters of the receiver from the one at anIndex to the end. If anIndex is equal to the length of the string, returns an empty string.

## See Also

### Dividing Strings

- [components(separatedBy:)](foundation/nsstring/components(separatedby:)-238fy.md)
- [components(separatedBy:)](foundation/nsstring/components(separatedby:)-27x9g.md)
- [trimmingCharacters(in:)](foundation/nsstring/trimmingcharacters(in:).md)
- [substring(with:)](foundation/nsstring/substring(with:).md)
- [substring(to:)](foundation/nsstring/substring(to:).md)
