Jump to content
  • Advertisement
Sign in to follow this  
ronkfist

string class (C++)

This topic is 4404 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

I was wondering what "managed" string classes are generally being used by C++ programmers. Right now I'm using a homemade one, but I figured there are probably much better ones out there. I need one that works at least on windows, linux and mac.

Share this post


Link to post
Share on other sites
Advertisement
std::string (I assume by "managed" you don't mean anything that has got to do with managed code)

Share this post


Link to post
Share on other sites
In the standard library there is a string class.

example


#include <string>
using namespace std;

string first_name = "Bjarne";
string last_name;

last_name = "Stroustrup";

string names = first_name + " " + last_name;
cout << names << endl;

names = last_name + ", " + first_name;
cout << names << endl;




There is lots of nice stuff beside the string class in the c++ standard library. Like managed dynamic arrays<vector>, linked list <list>. It's worth checking out.

Share this post


Link to post
Share on other sites
Standard C++ contains std::string. You can use it by including <string>.

There are more of these precious jewels: dynamic arrays, linked lists, sorting algorithms. See for example cppreference.com and a gazillion other sites. These things make your life better [wink].

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
std::string

Share this post


Link to post
Share on other sites
ok thanks std::string it will be then.

I really should use the standard C++ librabry more often, it would probably save me alot of time :)

Share this post


Link to post
Share on other sites
Quote:
Original post by ronkfist
ok thanks std::string it will be then.

I really should use the standard C++ librabry more often, it would probably save me alot of time :)


That, and it would prevent having various gamedevers yelling 'std::string' at you. That'd sound just weird being pronounced at all, let alone yelled.

Share this post


Link to post
Share on other sites
Quote:
Original post by joanusdmentia
That, and it would prevent having various gamedevers yelling 'std::string' at you. That'd sound just weird being pronounced at all, let alone yelled.

I pronounce it "standard string." Hardly weird.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!