title: Delete leading comma
body: <p>I am reading info from a sqlite database to a .csv file. I am able to get the file to build, but each new line starts with a ",". I have done some android programming, but not much ios. I am thinking that the issue is componentsJoinedByString:@"," since it joins everything together, but I am not sure how to get rid of the "," at the beginning of each new line using this. Is there another way to join them to write to a csv file or a way to get rid of the first comma?</p>
  
  <pre><code>NSMutableArray *exportBike = [[NSMutableArray alloc] init];
  
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  
  NSString *docsPath = [paths objectAtIndex:0];
  
  NSString *path = [docsPath stringByAppendingPathComponent:@"MemberDB.sql"];
  
  FMDatabase *database = [FMDatabase databaseWithPath:path];
  
  [database open];
  
  FMResultSet *resultsBike = [database executeQuery:@"SELECT * FROM bike"];
  
  while([resultsBike next]) {
  
      NSString *name = [resultsBike stringForColumn:@"name"];
      NSInteger stage1HR  = [resultsBike intForColumn:@"stage1HR"];
      NSInteger stage1BP = [resultsBike intForColumn:@"stage1BP"];
      NSInteger stage2HR = [resultsBike intForColumn:@"stage2HR"];
      NSInteger stage2BP = [resultsBike intForColumn:@"stage2BP"];
      NSInteger stage3HR  = [resultsBike intForColumn:@"stage3HR"];
      NSInteger stage3BP = [resultsBike intForColumn:@"stage3BP"];
      NSInteger stage4HR  = [resultsBike intForColumn:@"stage4HR"];
      NSInteger stage4BP = [resultsBike intForColumn:@"stage4BP"];
      NSInteger stage5HR  = [resultsBike intForColumn:@"stage5HR"];
      NSInteger stage5BP = [resultsBike intForColumn:@"stage5BP"];
      NSInteger stage6HR  = [resultsBike intForColumn:@"stage6HR"];
      NSInteger stage6BP = [resultsBike intForColumn:@"stage6BP"];
      NSInteger stage7HR  = [resultsBike intForColumn:@"stage7HR"];
      NSInteger stage7BP = [resultsBike intForColumn:@"stage7BP"];
      NSInteger recoveryHR = [resultsBike intForColumn:@"recoveryHR"];
  
      NSLog(@"%@,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",name, stage1HR, stage1BP, stage2HR, stage2BP, stage3HR, stage3BP, stage4HR, stage4BP, stage5HR, stage5BP, stage6HR, stage6BP, stage7HR, stage7BP, recoveryHR);
  
      [exportBike addObject:[NSString stringWithFormat:@"%@,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d""\n",name, stage1HR, stage1BP, stage2HR, stage2BP, stage3HR, stage3BP, stage4HR, stage4BP, stage5HR, stage5BP, stage6HR, stage6BP, stage7HR, stage7BP, recoveryHR]];
  
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  
      NSString *savePath = [paths objectAtIndex:0];
  
      savePath = [savePath stringByAppendingPathComponent:@"bike.csv"];
  
      [[exportBike componentsJoinedByString:@","] writeToFile:savePath atomically:YES encoding:NSUTF8StringEncoding error:NULL];
  </code></pre>