Colobot
Functions
stringutils.h File Reference

Some useful string operations. More...

#include <cstddef>
#include <string>
#include <sstream>
Include dependency graph for stringutils.h:

Go to the source code of this file.

Functions

template<class T >
std::string StrUtils::ToString (T value, bool *ok=nullptr)
 Converts a value to string. More...
 
template<class T >
StrUtils::FromString (const std::string &str, bool *ok=nullptr)
 Converts a value to string. More...
 
unsigned int StrUtils::HexStringToInt (const std::string &str)
 Converts string of hex characters to int.
 
std::string StrUtils::Format (const char *fmt,...)
 Replacement for sprintf()
 
std::string StrUtils::Replace (const std::string &str, const std::string &oldStr, const std::string &newStr)
 Returns a string with every occurence of oldStr in str replaced to newStr.
 
std::string StrUtils::UnicodeCharToUtf8 (unsigned int ch)
 Converts a wide Unicode char to a single UTF-8 encoded char.
 
std::string StrUtils::UnicodeStringToUtf8 (const std::wstring &str)
 Converts a wide Unicode string to a UTF-8 encoded string.
 
unsigned int StrUtils::Utf8CharToUnicode (const std::string &ch)
 Converts a UTF-8 encoded single character to wide Unicode char.
 
std::wstring StrUtils::Utf8StringToUnicode (const std::string &str)
 Converts a UTF-8 encoded string to wide Unicode string.
 
int StrUtils::Utf8CharSizeAt (const std::string &str, unsigned int pos)
 Returns the size in bytes of UTF-8 character at given pos in a UTF-8 str.
 
std::size_t StrUtils::Utf8StringLength (const std::string &str)
 Returns the length in characters of UTF-8 string str.
 

Detailed Description

Some useful string operations.