You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+75-65Lines changed: 75 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,80 +48,80 @@ end
48
48
The options are the same for `parseLine` and `parse`, with the exception of `loadFromString` and `bufferSize`. `loadFromString` only works with `parse` and `bufferSize` can only be specified for `parseLine`.
49
49
50
50
The following are optional parameters passed in via the third argument as a table.
51
-
-`delimiter`
51
+
-`delimiter`
52
52
53
-
If your file doesn't use the comma character as the delimiter, you can specify your own. It is limited to one character and defaults to `,`
Also Note: If you apply a function to the headers via headerFunc, and want to select fields from fieldsToKeep, you need to have what the post-modified header would be in fieldsToKeep.
87
+
Also Note: If you apply a function to the headers via headerFunc, and want to select fields from fieldsToKeep, you need to have what the post-modified header would be in fieldsToKeep.
88
88
89
-
-`ignoreQuotes`
89
+
-`ignoreQuotes`
90
90
91
-
If `ignoreQuotes` is `true`, it will leave all quotes in the final parsed output. This is useful in situations where the fields aren't quoted, but contain quotes, or if the CSV didn't handle quotes correctly and you're trying to parse it.
91
+
If `ignoreQuotes` is `true`, it will leave all quotes in the final parsed output. This is useful in situations where the fields aren't quoted, but contain quotes, or if the CSV didn't handle quotes correctly and you're trying to parse it.
92
92
93
-
```lua
94
-
local options = {loadFromString=true, ignoreQuotes=true}
95
-
local actual = ftcsv.parse('a,b,c\n"apple,banana,carrot', options)
Set `headers` to `false` if the file you are reading doesn't have any headers. This will cause ftcsv to create indexed tables rather than a key-value tables for the output.
110
+
Set `headers` to `false` if the file you are reading doesn't have any headers. This will cause ftcsv to create indexed tables rather than a key-value tables for the output.
111
111
112
-
```lua
113
-
local options = {loadFromString=true, headers=false, delimiter=">"}
114
-
local actual = ftcsv.parse("apple>banana>carrot\ndiamond>emerald>pearl", options)
Note: Header-less files can still use the `rename` option and after a field has been renamed, it can specified as a field to keep. The `rename` syntax changes a little bit:
117
+
Note: Header-less files can still use the `rename` option and after a field has been renamed, it can specified as a field to keep. The `rename` syntax changes a little bit:
118
118
119
-
```lua
120
-
local options = {loadFromString=true, headers=false, rename={"a","b","c"}, fieldsToKeep={"a","b"}, delimiter=">"}
121
-
local actual = ftcsv.parse("apple>banana>carrot\ndiamond>emerald>pearl", options)
if `fieldsToKeep` is set in the encode process, only the fields specified will be written out to a file. The `fieldsToKeep` will be written out in the order that is specified.
if `onlyRequiredQuotes` is set to `true`, the output will only include quotes around fields that are quotes, have newlines, or contain the delimter.
159
169
160
-
if `fieldsToKeep` is set in the encode process, only the fields specified will be written out to a file. The `fieldsToKeep` will be written out in the order that is specified.
0 commit comments