467,116 Members | 1,255 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,116 developers. It's quick & easy.

string tokenize

there's in maya's scripting language mel, called tokenize, you simply tokenize("string i want to tokenize"," ",bufferArray[])

which will fill the fufferArray wih the first string tokenized accorfing to the second string, isnt there anything as staight forward as this in c++?
Oct 2 '07 #1
  • viewed: 2155
Share:
2 Replies
sicarie
Expert Mod 4TB
there's in maya's scripting language mel, called tokenize, you simply tokenize("string i want to tokenize"," ",bufferArray[])

which will fill the fufferArray wih the first string tokenized accorfing to the second string, isnt there anything as staight forward as this in c++?
Are you looking for something like strtok()?

PS - I'm moving this to the Forum section, please double-check where you are next time when you create a thread. Thanks.
Oct 2 '07 #2
weaknessforcats
Expert Mod 8TB
Are you looking for something like strtok()?
strtok() is used with C-strings. C++ uses string objects so strtok() is out.

Have you considered a stringstream??

Expand|Select|Wrap|Line Numbers
  1. string str("string I want to tokenize");
  2. stringstream ss;
  3. ss << str;
  4. string temp;
  5. while (ss.eof() == false)
  6. {
  7.    ss >> temp;
  8.    cout << temp << endl;
  9. }
  10.  
Oct 2 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Matthias Teege | last post: by
4 posts views Thread by beliavsky@aol.com | last post: by
28 posts views Thread by David Rubin | last post: by
10 posts views Thread by Alex | last post: by
4 posts views Thread by Kelvin@!!! | last post: by
9 posts views Thread by shyam | last post: by
20 posts views Thread by bubunia2000@yahoo.co.in | last post: by
8 posts views Thread by Mugunth | last post: by
4 posts views Thread by Phantom | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.