• 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: NSString bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString bug


  • Subject: Re: NSString bug
  • From: "Stephen C. Jensen" <email@hidden>
  • Date: Thu, 25 Sep 2003 18:49:33 -0700

Never mind... this is a known bug. See:

http://developer.apple.com/qa/qa2001/qa1202.html




I think I've found a bug in stringByTrimmingCharactersInSet...

I have a text field named "FirstNameField" in which the user can type in a name for searching. You can type in one or more letters, and the search algorithm will match whatever you know. What I discovered was that if you type in a search string and a space, the search algorithm returns nothing. No problem... I put in a "stringByTrimmingCharactersInSet" command while querying the field, like so:


[options appendString: [[FirstNameField stringValue]
stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceCharacterSet]]];
NSLog(@"FirstNameField: %@\n",
[[FirstNameField stringValue] stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceCharacterSet]]);
NSLog(@"FirstNameField: %@\n", [FirstNameField stringValue]);

When I put in two or more letters into the field, it works fine:

2003-09-25 16:04:31.582 MegaPhone[1227] FirstNameField: St
2003-09-25 16:04:31.582 MegaPhone[1227] FirstNameField: St


When I put in a single letter, it doesn't:

2003-09-25 16:05:01.412 MegaPhone[1227] FirstNameField:
2003-09-25 16:05:01.413 MegaPhone[1227] FirstNameField: S

The single letter is trimmed. This doesn't make sense. Any ideas?

Thanks!


--
_______________________________________________
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.


--


Stephen C. Jensen
X-37ALT DFRC Chief Engineer
Flight Systems Engineering Branch/Code RF
Dryden Flight Research Center
(661) 276-3841
<mailto:email@hidden>
_______________________________________________
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: 
 >NSString string (From: "Stephen C. Jensen" <email@hidden>)

  • Prev by Date: Comparing dates
  • Next by Date: Re: sudo in NSTask
  • Previous by thread: NSString string
  • Next by thread: Re: NSString string
  • Index(es):
    • Date
    • Thread