The csvtotsv( function converts comma separated text into tab separated text.
Parameters
This function has one parameter:
commatext – text containing comma separated values.
Description
This function converts comma separated text into a tab separated text array. For example, suppose you have a text file named Directory.csv that contains data like this:
"Adams, Dorothy",555-3000,dadams@gmail.com
"Franklin, Mark",555-4822,mfranklin@hotmail.com
"Smith, John",555-1212,jsmith@yahoo.com
"Wilson, Judy",555-9324,jwilson@acme.net
This data can be read into a variable and converted to tab separated format:
local phoneNumbers
phoneNumbers=csvtotsv(fileload("Directory.csv"))
The phoneNumbers variable now contains the same data, but separated by tabs instead of commas. However, commas inside quotes have not been converted into tabs.
Adams, Dorothy ▸ 555-3000 ▸ dadams@gmail.com
Franklin, Mark ▸ 555-4822 ▸ mfranklin@hotmail.com
Smith, John ▸ 555-1212 ▸ jsmith@yahoo.com
Wilson, Judy ▸ 555-9324 ▸ jwilson@acme.net
The tab separated format, which doesn’t require quotes for commas, is much simpler to work with if you need to further process or display the data.
See Also
History
Version | Status | Notes |
10.0 | New | New in this version. |