I'm working on a basic localization pipeline where a spreadsheet exports values as TSV (tab-separated values).
Numbers exports "TSV" but the output does not show a \t
character. If I open this .tsv in a text editor, the tab character is there. It also doesn't let me specify my delimiter.
Now, in swift, if I read this file, line by line, I would expect to get all my column values with this:
let columns = line.components(separatedBy: "\t")
But it does not return multiple values.
Does anyone know how to separate by tabs ?
It often happens this way. The answer presents itself shortly after the question.
The key is to use the unicode value and not \t
, as Numbers exports the tabs as unicode values, not as '\t'.
i.e. line.components(separatedBy: "\u{0009}")
And you should note that if you're editing files in Xcode to create a test case, you should set "indent with" to Tabs and not Spaces.