Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

begdev

macrumors newbie
Original poster
Mar 14, 2009
20
0
I'm learning C again, so that I really understand everything.
My objective is to get the value of a uitextfield input, which I know how to... and then based on each letter in order do something different.
So like if string[1] == a { NSLog(@"its a")}, if string[1] == b { NSLog(@"its a b")} and so on...

Now I know that strings are basically arrays. So if I'm correct, this should be possible, i just get the length of it, then do it for each one.. I'm just having trouble putting this into ObjC code. thanks.
 
use a characterAtIndex: message for your string. (really, if you would just have taken a look the NSString documentation, this should have jumped right at you...)
 
Don't use characterAtIndex.

NSStrings are not just a kind of array.

Read the String Programming Guide.
 
use a characterAtIndex: message for your string. (really, if you would just have taken a look the NSString documentation, this should have jumped right at you...)

yeah i just found that heh...
but thanks anyway, documentation isn't really handy for learning the basics and stuff, so i kinda filed it in my head as, "not helpful" but, i guess it is after all.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.