@@ -197,14 +197,14 @@ with respect to:
197
197
198
198
==== Row Separator
199
199
200
- RFC 4180 specifies the row separator CRLF (Ruby "\r\n").
200
+ RFC 4180 specifies the row separator CRLF (Ruby <tt> "\r\n"</tt> ).
201
201
202
- Although the \CSV default row separator is "\n",
203
- the parser also by default handles row seperator "\r" and the RFC-compliant "\r\n".
202
+ Although the \CSV default row separator is <tt> "\n"</tt> ,
203
+ the parser also by default handles row separator <tt> "\r"</tt> and the RFC-compliant <tt> "\r\n"</tt> .
204
204
205
205
===== Recipe: Handle Compliant Row Separator
206
206
207
- For strict compliance, use option +:row_sep+ to specify row separator "\r\n",
207
+ For strict compliance, use option +:row_sep+ to specify row separator <tt> "\r\n"</tt> ,
208
208
which allows the compliant row separator:
209
209
source = "foo,1\r\nbar,1\r\nbaz,2\r\n"
210
210
CSV.parse(source, row_sep: "\r\n") # => [["foo", "1"], ["bar", "1"], ["baz", "2"]]
@@ -219,13 +219,13 @@ But rejects other row separators:
219
219
===== Recipe: Handle Non-Compliant Row Separator
220
220
221
221
For data with non-compliant row separators, use option +:row_sep+.
222
- This example source uses semicolon (';' ) as its row separator:
222
+ This example source uses semicolon (<tt>";"</tt> ) as its row separator:
223
223
source = "foo,1;bar,1;baz,2;"
224
224
CSV.parse(source, row_sep: ';') # => [["foo", "1"], ["bar", "1"], ["baz", "2"]]
225
225
226
226
==== Column Separator
227
227
228
- RFC 4180 specifies column separator COMMA (Ruby ',' ).
228
+ RFC 4180 specifies column separator COMMA (Ruby <tt>","</tt> ).
229
229
230
230
===== Recipe: Handle Compliant Column Separator
231
231
@@ -237,25 +237,25 @@ you need not specify option +:col_sep+ for compliant data:
237
237
===== Recipe: Handle Non-Compliant Column Separator
238
238
239
239
For data with non-compliant column separators, use option +:col_sep+.
240
- This example source uses TAB ("\t") as its column separator:
240
+ This example source uses TAB (<tt> "\t"</tt> ) as its column separator:
241
241
source = "foo,1\tbar,1\tbaz,2"
242
242
CSV.parse(source, col_sep: "\t") # => [["foo", "1"], ["bar", "1"], ["baz", "2"]]
243
243
244
244
==== Quote Character
245
245
246
- RFC 4180 specifies quote character DQUOTE (Ruby '"' ).
246
+ RFC 4180 specifies quote character DQUOTE (Ruby <tt>"\""</tt> ).
247
247
248
248
===== Recipe: Handle Compliant Quote Character
249
249
250
- Because the \CSV default quote character is '"' ,
250
+ Because the \CSV default quote character is <tt>"\""</tt> ,
251
251
you need not specify option +:quote_char+ for compliant data:
252
252
source = "\"foo\",\"1\"\n\"bar\",\"1\"\n\"baz\",\"2\"\n"
253
253
CSV.parse(source) # => [["foo", "1"], ["bar", "1"], ["baz", "2"]]
254
254
255
255
===== Recipe: Handle Non-Compliant Quote Character
256
256
257
257
For data with non-compliant quote characters, use option +:quote_char+.
258
- This example source uses SQUOTE ("'") as its quote character:
258
+ This example source uses SQUOTE (<tt> "'"</tt> ) as its quote character:
259
259
source = "'foo','1'\n'bar','1'\n'baz','2'\n"
260
260
CSV.parse(source, quote_char: "'") # => [["foo", "1"], ["bar", "1"], ["baz", "2"]]
261
261
0 commit comments