Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-27-2010, 08:29 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 88
Default NSString == INFINITY

I am working on a calculator. When the user performs, say 50^50, the pow() function returns "+(infinity symbol)" with out the ()s. I don't want it to do that, I want to see if the string that shows the positive infinity does, and if so change a UILabel's text to "OverFlow" Here is the (very shortened) code:

Code:
if (answerString == [NSString stringWithFormat:@"+%d", INFINITY]) {
	overflow.textColor = [UIColor blackColor];
}
This if statement never evaluates true. So how do I see if an NSString's value is "+(infinity symbol)"?
qwertyp is offline   Reply With Quote
Old 01-28-2010, 01:03 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

You'll need to use the isEqualToString: method to compare your two strings. Like [stringa isEqualToString: stringb] . Otherwise you're just comparing pointers - comparing the locations of the two objects, not their contents.
__________________

Free Games!
smasher is offline   Reply With Quote
Reply

Bookmarks

Tags
infinity, nsstring

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 250
23 members and 227 guests
@sandris, ADY, beleg_1998, Dani77, diyora, FAED, fredidf, F_Bryant, iDifferent, JamesCahall, JasonR, mer10, Oral B, prchn4christ, Rudy, smithdale87, Speed, spiderguy84, stekki, tgjorgoski, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,755
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:08 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0