3

Can someone help me fix my code here. I am trying to do something simple iterate through the whole array that has NSString's in it convert them to NSIntegers and assign them to a NSInteger variable.

 for  (NSInteger *itemF in myNSArray) {
     //WHERE "slotA" is an NSInteger and "itemF" is stored as an NSString and I wanna conver to NSInteger 
     //and store is in the var.
     slotA=itemF;          
}  
Yuji
  • 34,103
  • 3
  • 70
  • 88
Nick LaMarca
  • 8,076
  • 31
  • 93
  • 152

1 Answers1

7
for (NSString *string in array)
{
  NSInteger integer = [string integerValue]; 
}
Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232