title: Converting string to an integer in ios
body: <p>I know this question has been asked many times. You can convert string to integer in this two ways:</p>
  
  <p><code>[myString intValue]</code> which returns a "C" type or <code>[myString integerValue]</code> which returns NSInteger. </p>
  
  <p>But my requirement looks like this:</p>
  
  <pre><code>int route1 = 12,route2 = 5,route3 = 6;
  for (int j = 1; j &lt; 4; j++) {
          int route = [[NSString stringWithFormat:@"route%i",j] integerValue];
          //do something using the route
  }
  </code></pre>
  
  <p>I need the route variable to take the values of the different routes depending on the value of variable j. </p>
  
  <p>How do i do it? Need some guidance on this.</p>