Question: In my app, I am trying to import the csv files as follow:

```
NSError *error;
    NSString *path1=[[NSString alloc]initWithContentsOfFile:CSVPath encoding:NSUTF8StringEncoding error:&error];
    NSLog(@"%@",path1);
    NSArray *messArr=[path1 componentsSeparatedByString:@"\n"];
    NSLog(@"%@",messArr);

```

**Question:**
When i try to log the array, it gives the last column values with many spaces like as follow:

**Path1:** student\_name,gender,email\_id

test1,male,a

test2,male,b

test3,male3,c

**messArr:** 

(
 "student\_name,gender,email\_id

",

```
"test1,male,a

```

",

```
"test2,male,b

```

",

```
"test3,male3,c"

```

)

Here i got the count is 4 but can't able to remove spaces.

So, I can't able to remove spaces from the messArr.
Why this happen? I don't know.
Help me to solve this problem.

i think there is a problem with which encoding scheme you used when you creating the csv file.

Thank you,

Answer: 
Please use CSV Parser available on Github repository.

[Use CSV parser for Objective-C](https://github.com/davedelong/CHCSVParser)

Thanks,
you can remove the spaces

by using this meted on each object of messier

```
NSString *str=[[messArr objectAtIndex:index] stringByTrimmingCharactersInSet: whitespaceAndNewlineCharacterSet];

```

use this str for your purpose.