• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSpellChecker Count Words
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSpellChecker Count Words


  • Subject: Re: NSSpellChecker Count Words
  • From: Timothy Ritchey <email@hidden>
  • Date: Tue, 4 Feb 2003 14:54:21 -0500

Okay, just for the record in case someone runs across this in the future, this works:

- (IBAction)wordCount:(id)sender
{
// count the words, and log to the command line
int wordCount = 0, count = 0;
NSRange range;
while(range.location != NSNotFound) {
range = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:
[[textViewController xmlTextStorage] string]
startingAt:NSMaxRange(range)
language:@""
wrap:NO
inSpellDocumentWithTag:0
wordCount:&count];
wordCount += count;
}
// ...
}

On Tuesday, February 4, 2003, at 02:37 PM, Douglas Davidson wrote:


On Monday, February 3, 2003, at 07:19 AM, Timothy Ritchey wrote:

I was wondering if anyone had any insights into using NSSpellChecker to count the number of words in a string. I am using it like:

int count = [[NSSpellChecker sharedSpellChecker] countWordsInString:aString language:@""];

No matter what I seem to do, I always get zero.

This is due to a bug in our spellcheckers. They currently don't count words unless they're checking spelling at the same time.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: NSSpellChecker Count Words (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: NSSpellChecker Count Words
  • Next by Date: __attribute__ section not supported?
  • Previous by thread: Re: NSSpellChecker Count Words
  • Next by thread: [AppleScript+Cocoa] NSScriptCommand misbehaving?
  • Index(es):
    • Date
    • Thread