Questions tagged [boost-tokenizer]

The Boost.Tokenizer C++ library provides a flexible and easy to use way to break a string or other character sequence into a series of tokens.

The Boost.Tokenizer C++ library provides a flexible and easy to use way to break a string or other character sequence into a series of tokens.

37 questions
1
vote
1 answer

How should I read and parse (real, proper, full-featured) CSVs in C++?

I've read: How can I read and parse CSV files in C++? but the title there is rather misleading. It's not asking about reading CSVs per se, just multi-line comma-delimited no-escaped-data files. Now, I want to parse actual CSVs - the proper format…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
3 answers

The "no known conversion" from const char* to an iterator error - another take

I'm doing the following: using namespace boost; const char* line = // ... size_t line_length = // ... // ... tokenizer > line_tokenizer( line, line + line_length, escaped_list_separator('\\', ',',…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
1 answer

string iterator incompatible for reading eachline

I have an std::ostringstream. I would like to iterate for each line of this std::ostringstream. I use boost::tokenizer : std::ostringstream HtmlStream; ............. typedef boost::tokenizer >…
Walter Fabio Simoni
  • 5,671
  • 15
  • 55
  • 80
1
vote
2 answers

How to match string values from two string vectors within a nested loop

I'm trying to find the indexes for certain header values in a CSV file so I can then use them to extract the data in those positions in the rest of the file. I'm adding the header values into a map so I can retain the indexes. I…
Dave Anderson
  • 11,836
  • 3
  • 58
  • 79
1
vote
3 answers

Read input file with backslash (\) delimiter c++

My input file is like this: C:\Users\DeadCoder\AppData\Local\CoCreate I am making a tree and I need to abstract the names of directories while reading from input file with \ delimiter. Like in the above example, i need to abstract separately c:,…
DeadCoder
  • 87
  • 1
  • 2
  • 9
1
vote
1 answer

c++ iterator loop vs index loop

I know this is very stupid question, but I wanted to clarify this. Let's say I have one string vector looks like, vector vnTemp; // suppose this vector has {1,2,3,4,5} vector::iterator vn_it; //Now, I want to print out only 1 to…
devEvan
  • 361
  • 4
  • 16
0
votes
0 answers

How to define boost::escaped_list_separator to consume quotes around tokens?

I am trying to parse data from a text file that is formatted in a predefined way, as follows: "GROUP","SCPT" "DATA","CPT1","1","0.000","0.004","","-0.2","-0.5","","","" I am using boost::tokenizer to do the parsing, as follows: using Tokenizer =…
0
votes
1 answer

How should I tokenize a string into char using boost

I am trying to tokenize a string into character using boost The present boost tokenizer will tokenize based on space typedef boost::tokenizer > tokenizer; boost::char_separator sep(""); tokenizer…
Jeffin Sam
  • 98
  • 7
0
votes
2 answers

How to use boost::tokenizer as a C++ class member?

I am replacing RWCTokenizer with boost::tokenizer and I can't get it to compile as the code is currently designed. This is what its basically doing right now: parse.h RWCTokenizer* myTokenizer; parse.C function parse::A …
user3416126
  • 148
  • 11
0
votes
1 answer

Boost tokenizer fails to parse csv file having field with double quote

I am parsing.csv file having two columns. I am trying to parse row using boost tokenizer from csv file in which one of field in row is in double quote(Ex: 1,"test"). After tokenizer, I am getting field without double quote in tok (1,test). typedef…
dev
  • 649
  • 9
  • 11
0
votes
0 answers

serach a csv file with comma as delimiter and double quotes as an escape using c++

basically i am trying to write a code to prompt the user to enter a word knowing that my csv file contains strings as entries and it retrieves all the entries similar to the word prompted by the user. say the user enters the following word:…
0
votes
0 answers

boost tokenizer to parse csv file with embedded double quote

Is any way to parse CSV using c++ boost tokenizer if embedded double-quote characters are represented by pair of double-quote characters? Wiki's article Comma-separated values says Each of the embedded double-quote characters must be represented by…
Daniil
  • 143
  • 3
  • 9
0
votes
1 answer

CSV parser in C++ doesn't read the first element

I extracted this piece of code to parse a CSV file, however it doesn't read the first element for the first n-1 rows. I can't figure it out why, and when I copy the data into a new empty file and save it as CSV file, the error disappears and it…
vlavyb
  • 25
  • 7
0
votes
1 answer

Can boost::split Be Used on a List of Only One Token?

I would like to iterate over a comma-separated list of strings and do things with each string. Is there a way to set boost::split to recognize both "abc,xyz" and "abc" as valid inputs? In other words, can Split return the entire input string if it…
Argent
  • 795
  • 2
  • 7
  • 25
0
votes
1 answer

string iterators incompatible boost::tokenizer

I have a simple code sample of a class that wraps boost::tokenizer. MyTokenizer.h #pragma once #include #include class MyTokenizer { public: typedef boost::tokenizer< boost::escaped_list_separator >…
rvabdn
  • 947
  • 6
  • 20