Skip to content

Commit 9c0c0f3

Browse files
committed
Fix issue #11
1 parent fa47cd2 commit 9c0c0f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CSVDocument.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#import "CSVDocument.h"
1111
#import "CSVRowObject.h"
1212

13+
#define AUTODETECT_NUM_FIRST_CHARS 1000
14+
1315

1416
@implementation CSVDocument
1517

@@ -58,11 +60,11 @@ - (NSUInteger) numRowsFromCSVString:(NSString *)string maxRows:(NSUInteger)maxRo
5860
NSMutableArray *thisRows = [NSMutableArray array];
5961
NSMutableArray *thisColumnKeys = [NSMutableArray array];
6062

61-
// Check whether the file uses ";" or TAB as separator by comparing relative occurrences in the first 200 chars
63+
// Check whether the file uses ";" or TAB as separator by comparing relative occurrences in the first AUTODETECT_NUM_FIRST_CHARS chars
6264
if (autoDetectSeparator) {
6365
self.separator = @",";
6466

65-
NSUInteger testStringLength = ([string length] > 200) ? 200 : [string length];
67+
NSUInteger testStringLength = ([string length] > AUTODETECT_NUM_FIRST_CHARS) ? AUTODETECT_NUM_FIRST_CHARS : [string length];
6668
NSString *testString = [string substringToIndex:testStringLength];
6769
NSArray *possSeparators = [NSArray arrayWithObjects:@";", @" ", @"|", nil];
6870

0 commit comments

Comments
 (0)