Getting Number From Character In NSString - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Getting Number From Character In NSString (/thread-4847.html)
Getting Number From Character In NSString - Nick - Oct 31, 2005 08:54 AM
I'm trying to extract an integer from the second character of an NSString but I can't seem to figure out how to get it. Here's what my call currently looks like (doesn't work). Can anyone help me out?
Getting Number From Character In NSString - willThimbleby - Oct 31, 2005 09:54 AM
From the look of your code you want to do [crateList objectAtIndex:[[missileStatus substringWithRange:NSMakeRange(1, 1)] intValue]]
1. objectAtIndex: takes an int not an object
2. I suspect you don't want to be dealing in actual character values but their English equivalents, numberWithChar: will give you 49 for '1'
Getting Number From Character In NSString - Nick - Oct 31, 2005 10:08 AM