• 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 Variable Comparision
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString Variable Comparision


  • Subject: Re: NSString Variable Comparision
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Wed, 9 Jul 2003 13:58:03 -0400

On Wednesday, July 09, 2003, at 13:04, Vibhu Mishra wrote:

Greetings again,
Can I compare two NSString Variables, if so how do I do it?
I believe for two integer, float etc variables, we use
if (int a == int b){
//
}
What do I do for two NSString variables.

If you want to know if the contents of the two strings are the same, then use:
if([stringA isEqualToString: stringB])
{
//
}

If you want to know if the two variables point to the same string object, then use:
if(stringA == stringB)
{
//
}

I strongly suspect that you want the first one.


--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
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 Variable Comparision (From: Vibhu Mishra <email@hidden>)

  • Prev by Date: Re: How do I add a perl script to a project?
  • Next by Date: Re: NSTableView with images
  • Previous by thread: NSString Variable Comparision
  • Next by thread: Re: NSString Variable Comparision
  • Index(es):
    • Date
    • Thread