1

After separating fields with

var fields = row.characters.split {$0 == "\t"}.map { String($0) }

the debugger shows "unable to read data" for one field. What does it mean, except there is no data? I want to check it, but it is no empty string ("") and it's not nil.

Ivar
  • 6,138
  • 12
  • 49
  • 61
Peter71
  • 2,180
  • 4
  • 20
  • 33

1 Answers1

0

Are you using Swift 2 in XCode 7? Might wanna give this a try:

var fields = row.characters.split {"\t"}.map(String.init)

Or maybe your problem is that row ends with a "\t" and the final string is not valid for String init. I would suggest split and then print your results as debug.

source: Ethan's answer

Community
  • 1
  • 1
Fdo
  • 1,053
  • 4
  • 15
  • 38
  • Yes, I'm using the latest version of XCode (7.2). It is not the final entry, it is in the middle. I found out that I could concatenate strings including this "unable" one and get a "-" character from this source. So I could check for "-" but this is not proper, bc. also "-" could be a valid value. – Peter71 Jan 08 '16 at 13:42