---
title: "characterIndex(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextinputclient/characterindex(for:)"
---

# characterIndex(for:)

Returns the index of the character whose bounding rectangle includes the given point.

## Declaration

```swift
func characterIndex(for point: NSPoint) -> Int
```

## Parameters

- `point`: The point to test, in screen coordinates.

## Return Value

Return Value The character index, measured from the start of the receiver’s text storage, of the character containing the given point. Returns NSNotFound if the cursor is not within a character’s bounding rectangle.

## See Also

### Getting character coordinates

- [firstRect(forCharacterRange:actualRange:)](appkit/nstextinputclient/firstrect(forcharacterrange:actualrange:).md)
- [baselineDeltaForCharacter(at:)](appkit/nstextinputclient/baselinedeltaforcharacter(at:).md)
- [drawsVerticallyForCharacter(at:)](appkit/nstextinputclient/drawsverticallyforcharacter(at:).md)
- [fractionOfDistanceThroughGlyph(for:)](appkit/nstextinputclient/fractionofdistancethroughglyph(for:).md)
