mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Compare commits
3 Commits
72c1c0f7ff
...
e678b3a8b3
Author | SHA1 | Date | |
---|---|---|---|
|
e678b3a8b3 | ||
|
989354c4a6 | ||
|
6016dcba8c |
@ -5,16 +5,20 @@ contributors:
|
|||||||
- [Timon Erhart, 'https://github.com/turbotimon/']
|
- [Timon Erhart, 'https://github.com/turbotimon/']
|
||||||
---
|
---
|
||||||
|
|
||||||
CSV (Comma-Separated Values) is a lightweight file format used to store tabular data in plain text, designed for easy data exchange between programs, particularly spreadsheets and databases. Its simplicity and human readability have made it a cornerstone of data interoperability. It is often used for moving data between programs with incompatible or proprietary formats.
|
CSV (Comma-Separated Values) is a lightweight file format used to store tabular
|
||||||
|
data in plain text, designed for easy data exchange between programs,
|
||||||
|
particularly spreadsheets and databases. Its simplicity and human readability
|
||||||
|
have made it a cornerstone of data interoperability. It is often used for
|
||||||
|
moving data between programs with incompatible or proprietary formats.
|
||||||
|
|
||||||
While RFC 4180 provides a standard for the format, in practice, the term "CSV" is often used more broadly to refer to any text file that:
|
While RFC 4180 provides a standard for the format, in practice, the term "CSV"
|
||||||
|
is often used more broadly to refer to any text file that:
|
||||||
|
|
||||||
- Can be interpreted as tabular data
|
- Can be interpreted as tabular data
|
||||||
- Uses a delimiter to separate fields (columns)
|
- Uses a delimiter to separate fields (columns)
|
||||||
- Uses line breaks to separate records (rows)
|
- Uses line breaks to separate records (rows)
|
||||||
- Optionally includes a header in the first row
|
- Optionally includes a header in the first row
|
||||||
|
|
||||||
|
|
||||||
```csv
|
```csv
|
||||||
Name, Age, DateOfBirth
|
Name, Age, DateOfBirth
|
||||||
Alice, 30, 1993-05-14
|
Alice, 30, 1993-05-14
|
||||||
@ -24,7 +28,12 @@ Charlie, 35, 1988-03-21
|
|||||||
|
|
||||||
**Delimiters for Rows and Columns**
|
**Delimiters for Rows and Columns**
|
||||||
|
|
||||||
Rows are typically separated by line breaks (`\n` or `\r\n`), while columns (fields) are separated by a specific delimiter. Although commas are the most common delimiter for fields, other characters, such as semicolons (`;`), are commonly used in regions where commas are decimal separators (e.g., Germany). Tabs (`\t`) are also used as delimiters in some cases, with such files often referred to as "TSV" (Tab-Separated Values).
|
Rows are typically separated by line breaks (`\n` or `\r\n`), while columns
|
||||||
|
(fields) are separated by a specific delimiter. Although commas are the most
|
||||||
|
common delimiter for fields, other characters, such as semicolons (`;`), are
|
||||||
|
commonly used in regions where commas are decimal separators (e.g., Germany).
|
||||||
|
Tabs (`\t`) are also used as delimiters in some cases, with such files often
|
||||||
|
referred to as "TSV" (Tab-Separated Values).
|
||||||
|
|
||||||
Example using semicolons as delimiter and comma for decimal separator:
|
Example using semicolons as delimiter and comma for decimal separator:
|
||||||
|
|
||||||
@ -37,7 +46,9 @@ Charlie; 35; 60,00
|
|||||||
|
|
||||||
**Data Types**
|
**Data Types**
|
||||||
|
|
||||||
CSV files do not inherently define data types. Numbers and dates are stored as plain text, and their interpretation depends on the software importing the file. Typically, data is interpreted as follows:
|
CSV files do not inherently define data types. Numbers and dates are stored as
|
||||||
|
plain text, and their interpretation depends on the software importing the
|
||||||
|
file. Typically, data is interpreted as follows:
|
||||||
|
|
||||||
```csv
|
```csv
|
||||||
Data, Comment
|
Data, Comment
|
||||||
@ -50,7 +61,10 @@ Hello World, Interpreted as text (string)
|
|||||||
|
|
||||||
**Quoting Strings and Special Characters**
|
**Quoting Strings and Special Characters**
|
||||||
|
|
||||||
Quoting strings is only required if the string contains the delimiter, special characters, or otherwise could be interpreted as a number. However, it is often considered good practice to quote all strings to enhance readability and robustness.
|
Quoting strings is only required if the string contains the delimiter, special
|
||||||
|
characters, or otherwise could be interpreted as a number. However, it is
|
||||||
|
often considered good practice to quote all strings to enhance readability and
|
||||||
|
robustness.
|
||||||
|
|
||||||
```csv
|
```csv
|
||||||
Quoting strings examples,
|
Quoting strings examples,
|
||||||
@ -62,13 +76,18 @@ Unquoted string,
|
|||||||
"or in some systems with a backslash \" (like other escapes)",
|
"or in some systems with a backslash \" (like other escapes)",
|
||||||
```
|
```
|
||||||
|
|
||||||
However, make sure that for one document, the quoting method is consistent. For example, the last two examples of quoting with either "" or \" would not be consistent and could cause problems.
|
However, make sure that for one document, the quoting method is consistent.
|
||||||
|
For example, the last two examples of quoting with either "" or \" would
|
||||||
|
not be consistent and could cause problems.
|
||||||
|
|
||||||
**Encoding**
|
**Encoding**
|
||||||
|
|
||||||
Different encodings are used. Most modern CSV files use UTF-8 encoding, but older systems might use others like ASCII or ISO-8859.
|
Different encodings are used. Most modern CSV files use UTF-8 encoding, but
|
||||||
|
older systems might use others like ASCII or ISO-8859.
|
||||||
|
|
||||||
If the file is transferred or shared between different systems, it is a good practice to explicitly define the encoding used, to avoid issues with character misinterpretation.
|
If the file is transferred or shared between different systems, it is a good
|
||||||
|
practice to explicitly define the encoding used, to avoid issues with
|
||||||
|
character misinterpretation.
|
||||||
|
|
||||||
### More Resources
|
### More Resources
|
||||||
|
|
||||||
|
@ -20,9 +20,6 @@ desarrollo activo para traer aún más funciones.
|
|||||||
[Coco]: http://satyr.github.io/coco/
|
[Coco]: http://satyr.github.io/coco/
|
||||||
[CoffeeScript]: http://coffeescript.org/
|
[CoffeeScript]: http://coffeescript.org/
|
||||||
|
|
||||||
La retroalimentación siempre es bienvenida, así que sientete libre de
|
|
||||||
contactarme en [@kurisuwhyte](https://twitter.com/kurisuwhyte) :)
|
|
||||||
|
|
||||||
```livescript
|
```livescript
|
||||||
# Justo como su primo CoffeeScript, LiveScript usa símbolos de gato para
|
# Justo como su primo CoffeeScript, LiveScript usa símbolos de gato para
|
||||||
# comentarios de una sola línea
|
# comentarios de una sola línea
|
||||||
|
@ -21,10 +21,6 @@ avec lequel il a beaucoup plus de compatibilité.
|
|||||||
[Coco]: http://satyr.github.io/coco/
|
[Coco]: http://satyr.github.io/coco/
|
||||||
[CoffeeScript]: http://coffeescript.org/
|
[CoffeeScript]: http://coffeescript.org/
|
||||||
|
|
||||||
Vous pouvez contacter l'auteur du guide original en anglais ici :
|
|
||||||
[@kurisuwhyte](https://twitter.com/kurisuwhyte)
|
|
||||||
|
|
||||||
|
|
||||||
```livescript
|
```livescript
|
||||||
# Comme son cousin CoffeeScript, LiveScript utilise le symbole dièse pour les
|
# Comme son cousin CoffeeScript, LiveScript utilise le symbole dièse pour les
|
||||||
# commentaires sur une ligne.
|
# commentaires sur une ligne.
|
||||||
|
@ -7,20 +7,12 @@ contributors:
|
|||||||
|
|
||||||
LiveScript is a functional compile-to-JavaScript language which shares
|
LiveScript is a functional compile-to-JavaScript language which shares
|
||||||
most of the underlying semantics with its host language. Nice additions
|
most of the underlying semantics with its host language. Nice additions
|
||||||
comes with currying, function composition, pattern matching and lots of
|
come with currying, function composition, pattern matching and lots of
|
||||||
other goodies heavily borrowed from languages like Haskell, F# and
|
other goodies heavily borrowed from languages like Haskell, F# and
|
||||||
Scala.
|
Scala.
|
||||||
|
|
||||||
LiveScript is a fork of [Coco][], which is itself a fork of
|
LiveScript is a fork of [Coco](https://github.com/satyr/coco), which is
|
||||||
[CoffeeScript][]. The language is stable, and a new version is in active
|
itself a fork of [CoffeeScript](https://coffeescript.org/).
|
||||||
development to bring a plethora of new niceties!
|
|
||||||
|
|
||||||
[Coco]: http://satyr.github.io/coco/
|
|
||||||
[CoffeeScript]: http://coffeescript.org/
|
|
||||||
|
|
||||||
Feedback is always welcome, so feel free to reach me over at
|
|
||||||
[@kurisuwhyte](https://twitter.com/kurisuwhyte) :)
|
|
||||||
|
|
||||||
|
|
||||||
```livescript
|
```livescript
|
||||||
# Just like its CoffeeScript cousin, LiveScript uses number symbols for
|
# Just like its CoffeeScript cousin, LiveScript uses number symbols for
|
||||||
|
@ -17,10 +17,6 @@ LiveScript 目前已释出稳定版本,开发中的新版本将会加入更多
|
|||||||
[Coco]: http://satyr.github.io/coco/
|
[Coco]: http://satyr.github.io/coco/
|
||||||
[CoffeeScript]: http://coffeescript.org/
|
[CoffeeScript]: http://coffeescript.org/
|
||||||
|
|
||||||
非常期待您的反馈,你可以通过
|
|
||||||
[@kurisuwhyte](https://twitter.com/kurisuwhyte) 与我连系 :)
|
|
||||||
|
|
||||||
|
|
||||||
```livescript
|
```livescript
|
||||||
# 与 CoffeeScript 一样,LiveScript 使用 # 单行注解。
|
# 与 CoffeeScript 一样,LiveScript 使用 # 单行注解。
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user