Commit c20bdd68 authored by louiz’'s avatar louiz’

Add utils::revstr

parent d8da7984
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <config/config.hpp> #include <config/config.hpp>
#include <bridge/colors.hpp> #include <bridge/colors.hpp>
#include <utils/tolower.hpp> #include <utils/tolower.hpp>
#include <utils/revstr.hpp>
#include <irc/irc_user.hpp> #include <irc/irc_user.hpp>
#include <utils/split.hpp> #include <utils/split.hpp>
#include <xmpp/jid.hpp> #include <xmpp/jid.hpp>
...@@ -161,6 +162,9 @@ int main() ...@@ -161,6 +162,9 @@ int main()
std::cout << lowercase << std::endl; std::cout << lowercase << std::endl;
assert(lowercase == "coucou les copains ♥"); assert(lowercase == "coucou les copains ♥");
const std::string ltr = "coucou";
assert(utils::revstr(ltr) == "uocuoc");
/** /**
* XML parsing * XML parsing
*/ */
......
#include <utils/revstr.hpp>
namespace utils
{
std::string revstr(const std::string& original)
{
return {original.rbegin(), original.rend()};
}
}
#ifndef REVSTRP_INCLUDED
# define REVSTR_INCLUDED
#include <string>
namespace utils
{
std::string revstr(const std::string& original);
}
#endif // REVSTR_INCLUDED
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment