---
title: "spellServer(_:findMisspelledWordIn:language:wordCount:countOnly:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsspellserverdelegate/spellserver(_:findmisspelledwordin:language:wordcount:countonly:)"
---

# spellServer(_:findMisspelledWordIn:language:wordCount:countOnly:)

Asks the delegate to search for a misspelled word in a given string, using the specified language, and marking the first misspelled word found by returning its range within the string.

## Declaration

```swift
optional func spellServer(_ sender: NSSpellServer, findMisspelledWordIn stringToCheck: String, language: String, wordCount: UnsafeMutablePointer<Int>, countOnly: Bool) -> NSRange
```

## Parameters

- `sender`: The NSSpellServer object that sent this message.
- `stringToCheck`: The string to search for the misspelled word.
- `language`: The language to use for the search.
- `wordCount`: On output, returns by reference the number of words from the beginning of the string object until the misspelled word (or the end of string).
- `countOnly`: If doc://com.apple.documentation/documentation/Swift/true, the method only counts the words in the string object and does not spell checking.

## Return Value

Return Value The range of the misspelled word within the given string.

## Discussion

Discussion Send isWord(inUserDictionaries:caseSensitive:) to the spelling server to determine if the word exists in the user’s language dictionaries.

## See Also

### Check Grammar and Spelling in Strings

- [spellServer(_:check:offset:types:options:orthography:wordCount:)](foundation/nsspellserverdelegate/spellserver(_:check:offset:types:options:orthography:wordcount:).md)
- [spellServer(_:suggestGuessesForWord:inLanguage:)](foundation/nsspellserverdelegate/spellserver(_:suggestguessesforword:inlanguage:).md)
- [spellServer(_:checkGrammarIn:language:details:)](foundation/nsspellserverdelegate/spellserver(_:checkgrammarin:language:details:).md)
