Skip to main content

Timeline for How do I tokenize a string in C++?

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
May 7, 2023 at 8:00 history edited einpoklum CC BY-SA 4.0
Using `std::` qualifiers, using the string OP mentioned in the question
Sep 15, 2022 at 17:33 comment added Calmarius If the string ends with a delimiter you won't get a final empty entry. This is because lines are by definition end with a end-of-line character.
Feb 6, 2020 at 21:01 history bounty ended CommunityBot
Jun 1, 2019 at 21:31 comment added Nils THAT is the answer, the name of the function is just a bit awkward.
Apr 30, 2014 at 7:09 comment added Deqing Cool! No boost and C++11, good solution to the those legacy projects out there!
Aug 3, 2013 at 12:34 comment added fuzzyTew it's too bad getline returns the stream rather than the string, making it unusable in initialization lists without temporary storage
Jun 19, 2012 at 21:28 comment added hackrock This is good but just have to keep in mind that by doing this the default delimiter '\n' is not considered. This example will work, but if you are using something like : while(getline(inFile,word,' ')) where inFile is ifstream object containing multiple lines you will get funnny results..
Jan 24, 2011 at 23:00 comment added Ryan H. I had problems using this technique with 0x0A characters in the string which made the while loop exit prematurely. Otherwise, it's a nice simple and quick solution.
Mar 4, 2010 at 12:12 history edited Dominic Rodger CC BY-SA 2.5
added 25 characters in body
Nov 28, 2008 at 4:17 history answered user35978 CC BY-SA 2.5