Discussion in 'Automated Trading' started by bidask, Feb 21, 2007.
how do you write a split function in c++? there is a split function in java and vb, but not in c++.
If using STL roll your own with find_first_ and find_last_ , of/not
two other questions
1) what if i want to split by line (separate each line) instead of by the delimiter within each line?
2) what is the easiest way to put each split up item into an array?
You can also use boost http://www.boost.org/libs/tokenizer/index.html
If you are using a modern C++ compiler.
1) fixed length or variable length? If the latter, how 'bout splitting on \n or similar for your desired OS.
2) Use an STL container such as vector.
Regarding string routines, wxwidgets, a cross platform GUI framework, has a nice string implementation that can be used outside of wxWidgets. You might give it a look. www.wxwidgets.org
do you guys know of a friendly c++ forum that has a nice mix of beginners and pros?
When I was developing C++ I used to look at the moderated newsgroup. I think it was comp.lang.c++.moderated.
There were some tough people there at the time, like Andrew Koenig and sometimes Stroustrup himself
yeah, the usenet forums are good. i like codeguru forums as well.
that forum has everything. Back in my programming days, that's the only place I went to.
If you want to learn C++ from scratch, this may not be a bad path:
Get the book <i>C++ Primer Plus, 5th Edition</i>. It has very thorough explanations of basic topics. You may also want to get <i>C Primer Plus, 5th Edition</i>. Amazon sells them as a bundle. <i>C++ Primer</i> is good as well, but I find the writing style of the 'Plus' book to be easier to follow for the newbie.
Also, check out Trolltech's Qt library. You will find a great wealth of functions to perform the splits and so on that you desire. Qt has amazing documentation and examples that, in and of itself, will provide an awesome programming education. Search the forums here to read about some others' experiences with Qt. There is seriously no easier way to get starting creating C++ GUI applications, and they can be compiled on various platforms with virtually the same code base. You can even integrate the open-source edition of Qt 4 with Visual Studio - check out http://qtnode.net for more info on that.
Separate names with a comma.