Loading...
Searching...
No Matches
String.hpp
Go to the documentation of this file.
7// In no event will the authors be held liable for any damages arising from the use of this software.
Utility string class that automatically handles conversions between types and encodings.
Definition String.hpp:89
const char32_t * getData() const
Get a pointer to the C-style array of characters.
String(const std::string &ansiString, const std::locale &locale={})
Construct from an ANSI string and a locale.
bool operator>=(const String &left, const String &right)
Overload of operator>= to compare two UTF-32 strings.
std::string toAnsiString(const std::locale &locale={}) const
Convert the Unicode string to an ANSI string.
bool operator!=(const String &left, const String &right)
Overload of operator!= to compare two UTF-32 strings.
friend bool operator==(const String &left, const String &right)
String substring(std::size_t position, std::size_t length=InvalidPos) const
Return a part of the string.
String(char ansiChar, const std::locale &locale={})
Construct from a single ANSI character and a locale.
friend bool operator<(const String &left, const String &right)
String(const wchar_t *wideString)
Construct from null-terminated C-style wide string.
char32_t operator[](std::size_t index) const
Overload of operator[] to access a character by its position.
String(const char *ansiString, const std::locale &locale={})
Construct from a null-terminated C-style ANSI string and a locale.
static String fromUtf16(T begin, T end)
Create a new sf::String from a UTF-16 encoded string.
void replace(const String &searchFor, const String &replaceWith)
Replace all occurrences of a substring with a replacement string.
std::wstring toWideString() const
Convert the Unicode string to a wide string.
std::size_t find(const String &str, std::size_t start=0) const
Find a sequence of one or more characters in the string.
static String fromUtf8(T begin, T end)
Create a new sf::String from a UTF-8 encoded string.
void erase(std::size_t position, std::size_t count=1)
Erase one or more characters from the string.
static String fromUtf32(T begin, T end)
Create a new sf::String from a UTF-32 encoded string.
bool operator<=(const String &left, const String &right)
Overload of operator<= to compare two UTF-32 strings.
char32_t & operator[](std::size_t index)
Overload of operator[] to access a character by its position.
bool operator>(const String &left, const String &right)
Overload of operator> to compare two UTF-32 strings.
String(const char32_t *utf32String)
Construct from a null-terminated C-style UTF-32 string.
void insert(std::size_t position, const String &str)
Insert one or more characters into the string.
void replace(std::size_t position, std::size_t length, const String &replaceWith)
Replace a substring with another string.
String operator+(const String &left, const String &right)
Overload of binary operator+ to concatenate two strings.
String(std::nullptr_t, const std::locale &={})=delete
Deleted std::nullptr_t constructor.
String & operator+=(const String &right)
Overload of operator+= to append an UTF-32 string.
Definition AudioResource.hpp:36
std::basic_string< std::uint8_t, U8StringCharTraits > U8String
Portable replacement for std::basic_string<std::uint8_t>
Definition String.hpp:81
static bool eq_int_type(int_type i1, int_type i2) noexcept
static void assign(char_type &c1, char_type c2) noexcept
static char_type * copy(char_type *s1, const char_type *s2, std::size_t n)
static bool eq(char_type c1, char_type c2) noexcept
static int_type to_int_type(char_type c) noexcept
static int_type eof() noexcept
static char_type * move(char_type *s1, const char_type *s2, std::size_t n)
static int compare(const char_type *s1, const char_type *s2, std::size_t n)
static std::size_t length(const char_type *s)
std::char_traits< char >::state_type state_type
Definition String.hpp:54
static bool lt(char_type c1, char_type c2) noexcept
static const char_type * find(const char_type *s, std::size_t n, const char_type &c)
static char_type to_char_type(int_type i) noexcept
static char_type * assign(char_type *s, std::size_t n, char_type c)