Skip to content

Commit

Permalink
Merge pull request #1 from VitusVeit/dev
Browse files Browse the repository at this point in the history
Numbers features push
  • Loading branch information
VitusVeit authored May 30, 2023
2 parents d16a17a + 91b9177 commit 4ea7172
Show file tree
Hide file tree
Showing 2 changed files with 398 additions and 112 deletions.
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TSVParser v 1.0 🖋️
# TSVParser v 1.1.0 🖋️
A simple and easy-to-use C++ TSV Parser, it can read TSV files, modify them, and export them.

For now, it only supports strings (that for a TSV Parser is probably enough) but I'll be working on adding more types if I have time.
Expand All @@ -7,15 +7,15 @@ Everything is inside a single header file `tsvParser`, just download it, put it
# Examples ⚙️
With TSVParser, you can access TSV files like they're two-dimensional arrays and add or remove rows and columns with `+=/-=` like they're strings:
```cpp
TSV myFile;
tsv::File myFile;

// You can create a row by a vector of strings.
myFile[0] = {"Name", "Age", "Job", "NA"};

myFile += Row({"Frank Freeman", "45", "Nuclear Scientist"});
myFile += tsv::Row({"Frank Freeman", "45", "Nuclear Scientist"});

// Or add them manually.
Row r1;
tsv::Row r1;

r1 += "Mario Rossi";
r1 += "25";
Expand All @@ -41,7 +41,7 @@ Result: 🫘
Of course, we can also load and export TSV files:
```cpp
TSV antherFileOfMine;
tsv::File antherFileOfMine;
// You can open other files or read from strings with 'OpenFile' and 'OpenString'.
antherFileOfMine.OpenFile("test.tsv");
Expand All @@ -59,6 +59,38 @@ Result: 🍫
| Bread | 1 | 5 |
| Chocolate Bar | 5 | 1,2 |

Since version `1.1.0`, TSV files have now support for numbers:
```cpp
tsv::File myFile;

myFile[0] = {"Integer", "Decimal", "Exponential"};

// Create a row.
tsv::Row r1;

// You can add integer and double numbers directly.
r1 += 4;
r1 += 2.2;

// Or add a string that follows the Google Sheets format or other spreadsheet editors.
r1[1] += "2,24";

// You add exponential numbers too, both directly and by string!
r1 += 2.3e+2;
r1[2] = "2.3e+2";

// Add the row to the file.
myFile += r1;

std::cout << myFile.ToString() << '\n';
```
Result: 🔢
| Integer | Decimal | Exponential |
|:--- |:--- |:--- |
| 4 | 4,44 | 2,3e+2 |
**NOTE**: In most spreadsheet editors, decimal numbers contain `,` and those who contain `.` are considerated text. So when converting to string/file, TSVWrapper will change all `.` contained in numbers to `,` for compatibility.
# License ⚖️
This library is under the MIT License, which means you can use this Parser for anything but I won't be liable for damages that this Parser could cause.
If you want to know more, you can check out the `LICENSE` file or the text written at the top of the `tsvParser.hpp` header.
Loading

0 comments on commit 4ea7172

Please sign in to comment.