<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextLineFragment/characterIndex(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextLineFragment(im)characterIndexForPoint:"
  },
  "title" : "characterIndex(for:)"
}
-->

# characterIndex(for:)

Returns character index for a point inside the line fragment coordinate system.

```
func characterIndex(for point: CGPoint) -> Int
```

## Parameters

`point`

The distance is from the upstream edge.

## Return Value

An integer that represents the character index at `point`.

---

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)