Handling strings the c++ way?

Discussion about everything. New games, 3d math, development tips...
Post Reply
r2d22k
Posts: 1
Joined: Tue Jul 14, 2009 9:47 pm

Handling strings the c++ way?

Post by r2d22k »

Haven't used c++ for quite a while, i have used c# and java instead during the last few years. Handling strings in java and c# is quite easy and straight forward but very different to c++, cause there are many different ways how one could handle strings in c++. Most of them are deprecated, but many tutorials and such on the net still teach the deprecated methods, the c way. So, does anyone know a tutorial or something like that, which shows the way strings should be handled in c++? It doesn't need to be very complex, i just need to refresh my memory.


And yes, it might be that my nick sounds familiar. I was an active member of the irrlicht community a few years ago, you might remember r2d2. But i forgot my password ^^ and the "forgot password" function doesn't work for me, so i had to create a new account -.-

so far, thx in advance
r2
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

http://en.wikibooks.org/wiki/C%2B%2B_Pr ... ams/string

This should be a good point to start from.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
r2d2
Posts: 211
Joined: Mon Nov 24, 2003 5:22 pm

Post by r2d2 »

Finally ^^ i got my beloved account back ^^

Thx that link is quite good :) and helped me very much in refreshing my memory :) i also found a quite useful site on the web: www.cplusplus.com it got a std reference :)
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Josie
Posts: 44
Joined: Sat Jul 25, 2009 4:08 am
Location: Griffin, Georgia, US
Contact:

Post by Josie »

Sylence's post is great. The STL (Standard Template Library) 's string implementation is the best and most modern, and when you combine that with string streams, you've got some powerful stuff.

Boost also has lexical cast, which can do some ridiculously awesome stuff with strings automatically.

Just remember that std::string is a container, so you can used standard algorithms and all sorts of cool things with strings in C++.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

std string all the time, every time. Using something like Irr strings only mess up your interopability with other library, and woes to you if that lib decided to implement it's own string system...
Josie
Posts: 44
Joined: Sat Jul 25, 2009 4:08 am
Location: Griffin, Georgia, US
Contact:

Post by Josie »

Dorth wrote:std string all the time, every time. Using something like Irr strings only mess up your interopability with other library, and woes to you if that lib decided to implement it's own string system...
Woes indeed. :lol:
Post Reply