Linked Questions

9 votes
4 answers
37k views

c++ tokenize std string [duplicate]

Possible Duplicate: How do I tokenize a string in C++? Hello I was wondering how I would tokenize a std string with strtok string line = "hello, world, bye"; char * pch = strtok(line.c_str(),...
Daniel Del Core's user avatar
9 votes
2 answers
24k views

How to split a file lines with space and tab differentiation? [duplicate]

I have a file in below format mon 01/01/1000(TAB)hi hello(TAB)how r you Is there any way to read the text in such a way to use '\t' alone as delimiter (and not space)? So sample output can be, ...
John's user avatar
  • 2,123
5 votes
3 answers
11k views

Splitting a line in C/C++ using whitespace as delimiter [duplicate]

Possible Duplicate: How do I tokenize a string in C++? pseudocode: Attributes[] = Split line(' ') How? I have been doing this: char *pch; pch = strtok(line," "); while(pch!=NULL) ...
andandandand's user avatar
  • 22.2k
18 votes
1 answer
61k views

Similar function to java's string.split(" ") in C++ [duplicate]

I am looking for the similar function in C++ to string.split(delimiter). It returns an array of strings cut by a specified delimiter. http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#...
user avatar
0 votes
5 answers
19k views

how to split a string on comma in C++ [duplicate]

I have this code currently in which the user would enter a number for how many numbers they want in the array. followed by '12345' however about a second after writing it i realized this would only ...
AngryDuck's user avatar
  • 4,507
0 votes
5 answers
5k views

C++ Strings Modifying and Extracting based on Separators [duplicate]

Kind of a basic question but I'm having troubles thinking of a solution so I need a push in the right direction. I have an input file that I'm pulling in, and I have to put it into one string ...
Doug's user avatar
  • 1,316
2 votes
3 answers
14k views

converting a std::string to an array of c strings [duplicate]

I'm trying to find a way to convert a string to array of c strings. So for example my string would be: std::string s = "This is a string." and then I would like the output to be something like this:...
Peter T.'s user avatar
3 votes
0 answers
17k views

c++: Split string by delimiter [duplicate]

For example I have this string: hello:there:world How do I split these three words to string array, I mean the final result will be this: arr[0] = "hello"; arr[1] = "there"; arr[2] = "world"; ...
user2658730's user avatar
4 votes
1 answer
9k views

Python C++: is the any python.split() like method in c++? [duplicate]

Possible Duplicate: How do I tokenize a string in C++? Splitting a string in C++ Is there any python.split(",") like method in C++ please.
user avatar
1 vote
3 answers
935 views

Split string into tokens - without OS-specific functions [duplicate]

Possible Duplicate: How do I tokenize a string in C++? strtok function is not thread safe. Microsoft has Windows-specific strtok_s and CString::Tokenize safe functions. Is there cross-platform ...
Alex F's user avatar
  • 43.1k
0 votes
1 answer
3k views

how to extract words from a string in C++ [duplicate]

Possible Duplicate: How do I tokenize a string in C++? I have a string "this is a string", and I want to iterate over all the words in this string. Is there a way in which i can easily do this ...
Anonymous's user avatar
  • 1,297
2 votes
1 answer
5k views

How to print out a certain part of a string [duplicate]

EDIT:I see how it works now, in the string myString it takes everything after the space. So how would this be done if you wanted to take the first name and not the last name, since now you can't use ...
Christoph's user avatar
  • 231
2 votes
2 answers
2k views

Parsing a string in C++ for assigning parameters [duplicate]

Possible Duplicate: How do I tokenize a string in C++? I have a string of the following form , which is a user input. a1 10.2 lib_t 50 sv 60 out 'true' Here, a1 is a parameter of type ...
memC's user avatar
  • 1,015
-3 votes
2 answers
2k views

what is the c++ equivalent of map(int,input().split()) of python? [duplicate]

I find it hard to do all the string manipulation and then parsing into an array of integers in c++ while we could get away with only a single line in python. whats the easiest way to split the string ...
Natesh bhat's user avatar
  • 12.9k
-1 votes
2 answers
2k views

c++ implementation of string split [duplicate]

Possible Duplicates: C++ split string How do I tokenize a string in C++? I'd like to parse a single line of text, which consist of several words separated by blanks. so I need to know the C++ ...
Haiyuan Zhang's user avatar

15 30 50 per page
1
2 3 4 5
13