title: How can we read args using command line in objective c?
body: <p>I am passing a hard-coded <code>NSString</code> and converting to <code>NSArray</code>. Here I want to pass an <code>NSString</code> using command line and convert to an <code>NSArray</code>:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  NSArray*sampleMethod(NSString*val){
      NSString *newStr = [val substringFromIndex:1];
      NSString *newStr1 = [newStr substringToIndex:[newStr length]-1];
      NSString *trimmed = [newStr1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
      NSArray *yourWords = [trimmed componentsSeparatedByString:@","];
  return yourWords;
  }
  int main(int argc, const char * argv[]) {
      NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
          NSString *value =@"{1,2,3}";// hard code value
          NSArray* ip1= sampleMethod(value);
      /*
      NSArray* ip1= sampleMethod(argv[1]);
      here i want to read from command line and convert in to array
      */
          printf("output: %@ ",ip1);
      [pool drain];
      return 0;
  } 
  </code></pre>