468,278 Members | 1,562 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Is there any STL function for sorting characters inside a string?

I'm looking for a STL function to sort characters inside a string,
like:

string_sort("disprove") ="deioprsv".

Sep 4 '07 #1
2 1518
Lambda wrote:
I'm looking for a STL function to sort characters inside a string,
like:

string_sort("disprove") ="deioprsv".
#include <iostream>
#include <string>
#include <algorithm>

int main()
{
std::string str("disprove");
std::sort(str.begin(), str.end());
std::cout << str << std::endl;
}
Sep 4 '07 #2
On Sep 4, 9:28 am, Barry <dh...@126.comwrote:
Lambda wrote:
I'm looking for a STL function to sort characters inside a string,
like:
string_sort("disprove") ="deioprsv".

#include <iostream>
#include <string>
#include <algorithm>

int main()
{
std::string str("disprove");
std::sort(str.begin(), str.end());
std::cout << str << std::endl;

}
Thanks. It's so easy, I just find out :)

Sep 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.