<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/String/Index/init(utf16Offset:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SS5IndexV11utf16Offset2inABSi_xtcSyRzlufc"
  },
  "title" : "init(utf16Offset:in:)"
}
-->

# init(utf16Offset:in:)

Creates a new index at the specified UTF-16 code unit offset

```
init<S>(utf16Offset offset: Int, in s: S) where S : StringProtocol
```

## Parameters

`offset`

An offset in UTF-16 code units.

`s`

The string.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)