• 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 searching for zero
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString searching for zero


  • Subject: Re: NSString searching for zero
  • From: Jonathan Jackel <email@hidden>
  • Date: Sun, 22 Sep 2002 08:47:58 -0400

How about :

If ([text isEqualToString:@"0000"]);

Or, if spaces in text should be disregarded:

If ([[text stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceCharacterSet]]
isEqualToString:@"0000"]);


Jonathan

on 9/22/02 7:48 AM, Claudius Sailer at email@hidden wrote:

> Hi,
>
> I have a NSString which includes only four time 'zero' (It comes from a
> CString). How can I check whether this NSString has for 'zero' or not?
>
> This doesn't work:
>
> if ([[text stringByTrimmingCharactersInSet:[NSCharacterSet
> whitespaceCharacterSet]] length] == 0)
>
> and this seems a little bit stupid:
>
> if (([text characterAtIndex:0] == 0) && ([text characterAtIndex:1] ==
> 0) && ([text characterAtIndex:2] == 0) && ([text characterAtIndex:3] ==
> 0))
>
> bye
>
>
> Claudius
> _______________________________________________
> 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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSString searching for zero
      • From: Ondra Cada <email@hidden>
    • Re: NSString searching for zero
      • From: Claudius Sailer <email@hidden>
References: 
 >NSString searching for zero (From: Claudius Sailer <email@hidden>)

  • Prev by Date: Re: NSRecentDocumentRecords
  • Next by Date: Re: NSString searching for zero
  • Previous by thread: NSString searching for zero
  • Next by thread: Re: NSString searching for zero
  • Index(es):
    • Date
    • Thread