Convert CSV records to TSV: Difference between revisions
Content added Content deleted
(julia example) |
m (handle \r) |
||
Line 253: | Line 253: | ||
end |
end |
||
t = join(p,"<TAB>") |
t = join(p,"<TAB>") |
||
s = replace(str, "\\" => "\\\\", "\t" => "\\t", "\0" => "\\0", "\n" => "\\n") |
s = replace(str, "\\" => "\\\\", "\t" => "\\t", "\0" => "\\0", "\n" => "\\n", "\r" => "\\r") |
||
t = replace(t, "\\" => "\\\\", "\t" => "\\t", "\0" => "\\0", "\n" => "\\n") |
t = replace(t, "\\" => "\\\\", "\t" => "\\t", "\0" => "\\0", "\n" => "\\n", "\r" => "\\r") |
||
return s, t |
return s, t |
||
end |
end |
||
Line 271: | Line 271: | ||
"a\0b", # That is a NUL character |
"a\0b", # That is a NUL character |
||
"a\nb", # That is a LF (linefeed) character |
"a\nb", # That is a LF (linefeed) character |
||
"a\rb", # That is a CR (carriage return) character |
|||
raw"a\b"] |
raw"a\b"] |
||
csv, tsv = csv_tsv(test_string) |
csv, tsv = csv_tsv(test_string) |
||
Line 289: | Line 290: | ||
a\0b => a\0b |
a\0b => a\0b |
||
a\nb => a\nb |
a\nb => a\nb |
||
a\rb => a\rb |
|||
a\\b => a\\b |
a\\b => a\\b |
||
</pre> |
</pre> |