Jump to content
  • Advertisement
Sign in to follow this  
Ninj4D4n

C++ string reference

This topic is 5397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The more I work on games and engines the more I'm starting to notice a trend. I really suck at manipulating strings and character data. I just never really learned how to work with them all too well over the last 5 years of my porgramming experience... so I was wondering if anyone could point out some good resources/references on working with strings in C++?? thanks in advance --Ninj4D4n

Share this post


Link to post
Share on other sites
Advertisement
What type of strings do you want to work with? C style strings (character arrays), C++ style strings (std::string, in the STL), or maybe even some other string implementation, like Microsoft's CString?

I'd suggest working with std::string. There are various member functions that do plenty of useful manipulations (the primary ones being .substr(), .insert() and .erase()). There are also other functions that aren't members that will alter a string. transform() (in <algorithm>) can do things like changing to lower/upper case, etc.

In addition to those, you can use std::stringstream to convert things to/from a string (primarily numbers).

Share this post


Link to post
Share on other sites
There also are some string algorithms slated for the next release of Boost (in the coming weeks).

That being said, Ninj4D4n, what precisely are you looking for?
"working with strings" is just as vague a task as "working with numbers".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!