Use the -isEqualToString:
method to compare the value of two strings. Using the C ==
operator will simply compare the addresses of the objects.
if ([category isEqualToString:@"Some String"])
{
// Do stuff...
}
More Related Contents:
- How to convert an NSString into an NSNumber
- Objective-C: Reading a file line by line
- Converting a string to an NSDate
- Remove all but numbers from NSString
- Check that a input to UITextField is numeric only
- Number of occurrences of a substring in an NSString?
- Any way to bold part of a NSString?
- Calculating the number of days between two dates in Objective-C
- NSString (hex) to bytes
- Is there a simple way to split a NSString into an array of characters?
- Search through NSString using Regular Expression
- NSString to CFStringRef and CFStringRef to NSString in ARC?
- How to add commas to number every 3 digits in Objective C?
- Remove characters from NSString?
- How to convert NSNumber to NSString
- Replacing one character in a string in Objective-C
- How to make subscripts and superscripts using NSAttributedString?
- Reverse NSString text
- Get parts of a NSURL in objective-c
- Using NSRegularExpression to extract URLs on the iPhone
- How to get substring of NSString?
- NSString : easy way to remove UTF-8 accents from a string?
- Convert string to float in Objective-C
- How Can I Draw Image with Text Wrapping on iOS?
- Converting NSString to NSDictionary / JSON
- sizeWithFont method is deprecated. boundingRectWithSize returns an unexpected value
- NSString – Convert to pure alphabet only (i.e. remove accents+punctuation)
- How to declare a two dimensional array of string type in Objective-C?
- How to get the width of an NSString?
- Anyway to get string from variable name?