Skip to content

Commit

Permalink
Added example
Browse files Browse the repository at this point in the history
  • Loading branch information
SaeidYazdani committed Oct 28, 2023
1 parent 75ce3eb commit 0d57081
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
6 changes: 5 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ project(embedonix_simplelibs_examples VERSION 0.1.0 LANGUAGES CXX)
add_executable(csvparsers
parsers/csvparser.cpp)


target_link_directories(csvparsers PRIVATE "F:\\Embedonix\\simplelibs-dbg")
target_link_libraries(csvparsers PRIVATE embedonix_simplelibs_parsers
PRIVATE embedonix_simplelibs_fileio
PRIVATE embedonix_simplelibs_stringtools)
target_include_directories(csvparsers PUBLIC "F:\\Embedonix\\simplelibs-dbg\\include")

34 changes: 31 additions & 3 deletions examples/parsers/csvparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,36 @@
//

#include <iostream>
#include <embedonix/simplelibs/fileio/filereader.h>
#include <embedonix/simplelibs/parsers/csvparser.h>
#include <embedonix/simplelibs/stringtools/trim.h>
#include <embedonix/simplelibs/stringtools/print.h>

int main(int argc, char** args) {
std::cout << "Welcome to CSVPARSER example!" << std::endl;
return 0;
using namespace embedonix::simplelibs;

int main(int argc, char **args) {
std::cout << "Welcome to CSVPARSER example!" << std::endl;
auto content = fileio::readers::read_file("G:\\Saeid Yazdani\\Downloads\\username.csv");
auto data = parsers::csv_file(content, ';');

for (auto i: data) {
for (auto j: i) {
std::cout << j << "\n";
}
}

for (size_t i = 0; i < data.size(); ++i) {
for (size_t j = 0; j < data[i].size(); ++j) {
std::cout << "["<< i << ", " << j << "] = "
<< stringtools::trim::both_sides_copy(data[i][j]) << " ";
}
std::cout << "\n";
}

for(const auto& row : data)
stringtools::print::container(row, ',');



return 0;
}

0 comments on commit 0d57081

Please sign in to comment.