Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::String Class Reference

Core class that represents a string. More...

Public Types

enum  Flags {
  None = 0x00, CaseInsensitive = 0x01, HandleUtf8 = 0x02, TrimOnlyLeft = 0x04,
  TrimOnlyRight = 0x08
}
 
typedef const char & const_reference
 
typedef char * iterator
 
typedef char value_type
 

Public Member Functions

 String ()
 Constructs a String object by default.
 
 String (char character)
 Constructs a String object with a character. More...
 
 String (std::size_t rep, char character)
 Constructs a String object with multiple times the same character. More...
 
 String (std::size_t rep, const char *string)
 Constructs a String object with multiple times the same string. More...
 
 String (std::size_t rep, const char *string, std::size_t length)
 Constructs a String object with multiple times the same string. More...
 
 String (std::size_t rep, const String &string)
 Constructs a String object with multiple times the same string. More...
 
 String (const char *string)
 Constructs a String object with a "C string". More...
 
 String (const char *string, std::size_t length)
 Constructs a String object with a "C string". More...
 
 String (const std::string &string)
 Constructs a String object which is a copy of another. More...
 
 String (const String &string)=default
 
 String (String &&string) noexcept=default
 
StringAppend (char character)
 Appends the character to the string. More...
 
StringAppend (const char *string)
 Appends the "C string" to the string. More...
 
StringAppend (const char *string, std::size_t length)
 Appends the "C string" to the string. More...
 
StringAppend (const String &string)
 Appends the string to the string. More...
 
void Clear (bool keepBuffer=false)
 Clears the content of the string. More...
 
bool Contains (char character, std::intmax_t start=0, UInt32 flags=None) const
 
bool Contains (const char *string, std::intmax_t start=0, UInt32 flags=None) const
 
bool Contains (const String &string, std::intmax_t start=0, UInt32 flags=None) const
 
unsigned int Count (char character, std::intmax_t start=0, UInt32 flags=None) const
 Counts the number of occurrences in the string. More...
 
unsigned int Count (const char *string, std::intmax_t start=0, UInt32 flags=None) const
 Counts the number of occurrences in the string. More...
 
unsigned int Count (const String &string, std::intmax_t start=0, UInt32 flags=None) const
 Counts the number of occurrences in the string. More...
 
unsigned int CountAny (const char *string, std::intmax_t start=0, UInt32 flags=None) const
 Counts the number of occurrences of any characters in the list in the string. More...
 
unsigned int CountAny (const String &string, std::intmax_t start=0, UInt32 flags=None) const
 Counts the number of occurrences of any characters in the list in the string. More...
 
bool EndsWith (char character, UInt32 flags=None) const
 Checks whether the string ends with the character. More...
 
bool EndsWith (const char *string, UInt32 flags=None) const
 Checks whether the string ends with the "C string". More...
 
bool EndsWith (const char *string, std::size_t length, UInt32 flags=None) const
 Checks whether the string ends with the "C string". More...
 
bool EndsWith (const String &string, UInt32 flags=None) const
 Checks whether the string ends with the string. More...
 
std::size_t Find (char character, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first index of the character in the string. More...
 
std::size_t Find (const char *string, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first index of the "C string" in the string. More...
 
std::size_t Find (const String &string, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first index of the string in the string. More...
 
std::size_t FindAny (const char *string, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first index of any characters in the list in the string. More...
 
std::size_t FindAny (const String &string, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first index of any characters in the list in the string. More...
 
std::size_t FindLast (char character, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last index of the character in the string. More...
 
std::size_t FindLast (const char *string, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last index of the "C string" in the string. More...
 
std::size_t FindLast (const String &string, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last index of the string in the string. More...
 
std::size_t FindLastAny (const char *string, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last index of any characters in the list in the string. More...
 
std::size_t FindLastAny (const String &string, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last index of any characters in the list in the string. More...
 
std::size_t FindLastWord (const char *string, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last word in the string. More...
 
std::size_t FindLastWord (const String &string, std::intmax_t start=-1, UInt32 flags=None) const
 Finds the last word in the string. More...
 
std::size_t FindWord (const char *string, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first word in the string. More...
 
std::size_t FindWord (const String &string, std::intmax_t start=0, UInt32 flags=None) const
 Finds the first word in the string. More...
 
char * GetBuffer ()
 Gets the raw buffer. More...
 
std::size_t GetCapacity () const
 Gets the capacity of the string. More...
 
std::size_t GetCharacterPosition (std::size_t characterIndex) const
 Gets the index where a character begin. More...
 
const char * GetConstBuffer () const
 Gets the raw buffer. More...
 
std::size_t GetLength () const
 Gets the length of the string. More...
 
std::size_t GetSize () const
 Gets the size of the string. More...
 
std::string GetUtf8String () const
 Gets the std::string corresponding. More...
 
std::u16string GetUtf16String () const
 Gets the std::string corresponding. More...
 
std::u32string GetUtf32String () const
 Gets the std::string corresponding. More...
 
std::wstring GetWideString () const
 Gets the std::wstring corresponding. More...
 
String GetWord (unsigned int index, UInt32 flags=None) const
 Gets the word until next separator. More...
 
std::size_t GetWordPosition (unsigned int index, UInt32 flags=None) const
 Gets the word position. More...
 
StringInsert (std::intmax_t pos, char character)
 Inserts the character into the string. More...
 
StringInsert (std::intmax_t pos, const char *string)
 Inserts the "C string" into the string. More...
 
StringInsert (std::intmax_t pos, const char *string, std::size_t length)
 Inserts the "C string" into the string. More...
 
StringInsert (std::intmax_t pos, const String &string)
 Inserts the string into the string. More...
 
bool IsEmpty () const
 Checks whether the string is empty. More...
 
bool IsNull () const
 Checks whether the string is null. More...
 
bool IsNumber (UInt8 radix=10, UInt32 flags=CaseInsensitive) const
 Checks whether the string is a number. More...
 
bool Match (const char *pattern) const
 Checks whether the string matches the pattern. More...
 
bool Match (const String &pattern) const
 Checks whether the string matches the pattern. More...
 
StringPrepend (char character)
 Prepends the character to the string. More...
 
StringPrepend (const char *string)
 Prepends the "C string" to the string. More...
 
StringPrepend (const char *string, std::size_t length)
 Prepends the "C string" to the string. More...
 
StringPrepend (const String &string)
 Prepends the string to the string. More...
 
unsigned int Replace (char oldCharacter, char newCharacter, std::intmax_t start=0, UInt32 flags=None)
 Replaces the old character by the new one. More...
 
unsigned int Replace (const char *oldString, const char *replaceString, std::intmax_t start=0, UInt32 flags=None)
 Replaces the old "C string" by the new one. More...
 
unsigned int Replace (const char *oldString, std::size_t oldLength, const char *replaceString, std::size_t replaceLength, std::intmax_t start=0, UInt32 flags=None)
 Replaces the old "C string" by the new one. More...
 
unsigned int Replace (const String &oldString, const String &replaceString, std::intmax_t start=0, UInt32 flags=None)
 Replaces the old string by the new one. More...
 
unsigned int ReplaceAny (const char *oldCharacters, char replaceCharacter, std::intmax_t start=0, UInt32 flags=None)
 Replaces the old characters in the list by the new one. More...
 
void Reserve (std::size_t bufferSize)
 Reserves enough memory for the buffer size. More...
 
StringResize (std::intmax_t size, UInt32 flags=None)
 Resizes the string. More...
 
String Resized (std::intmax_t size, UInt32 flags=None) const
 Resize a copy of the string. More...
 
StringReverse ()
 Reverses the string. More...
 
String Reversed () const
 Reverses a copy of the string. More...
 
StringSet (char character)
 Sets the string to the character. More...
 
StringSet (std::size_t rep, char character)
 Sets the string with multiple times the same character. More...
 
StringSet (std::size_t rep, const char *string)
 Sets the string with multiple times the same string. More...
 
StringSet (std::size_t rep, const char *string, std::size_t length)
 Sets the string with multiple times the same string. More...
 
StringSet (std::size_t rep, const String &string)
 Sets the string with multiple times the same string. More...
 
StringSet (const char *string)
 Sets the string with other "C string". More...
 
StringSet (const char *string, std::size_t length)
 Sets the string with other "C string". More...
 
StringSet (const std::string &string)
 Sets the string with a std::string. More...
 
StringSet (const String &string)
 Sets the string with other string. More...
 
StringSet (String &&string) noexcept
 Sets the string by move semantic. More...
 
String Simplified (UInt32 flags=None) const
 Simplifies a copy of the string. More...
 
StringSimplify (UInt32 flags=None)
 Simplifies the string. More...
 
unsigned int Split (std::vector< String > &result, char separation=' ', std::intmax_t start=0, UInt32 flags=None) const
 Splits the string into others. More...
 
unsigned int Split (std::vector< String > &result, const char *separation, std::intmax_t start=0, UInt32 flags=None) const
 Splits the string into others. More...
 
unsigned int Split (std::vector< String > &result, const char *separation, std::size_t length, std::intmax_t start=0, UInt32 flags=None) const
 Splits the string into others. More...
 
unsigned int Split (std::vector< String > &result, const String &separation, std::intmax_t start=0, UInt32 flags=None) const
 Splits the string into others. More...
 
unsigned int SplitAny (std::vector< String > &result, const char *separations, std::intmax_t start=0, UInt32 flags=None) const
 Splits the string into others. More...
 
unsigned int SplitAny (std::vector< String > &result, const String &separations, std::intmax_t start=0, UInt32 flags=None) const
 Splits the string into others. More...
 
bool StartsWith (char character, UInt32 flags=None) const
 Checks whether the string begins with the character. More...
 
bool StartsWith (const char *string, UInt32 flags=None) const
 Checks whether the string begins with the "C string". More...
 
bool StartsWith (const String &string, UInt32 flags=None) const
 Checks whether the string begins with the string. More...
 
String SubString (std::intmax_t startPos, std::intmax_t endPos=-1) const
 Returns a sub string of the string. More...
 
String SubStringFrom (char character, std::intmax_t startPos=0, bool fromLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string from a character. More...
 
String SubStringFrom (const char *string, std::intmax_t startPos=0, bool fromLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string from a string. More...
 
String SubStringFrom (const char *string, std::size_t length, std::intmax_t startPos=0, bool fromLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string from a string. More...
 
String SubStringFrom (const String &string, std::intmax_t startPos=0, bool fromLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string from a string. More...
 
String SubStringTo (char character, std::intmax_t startPos=0, bool toLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string up to a character. More...
 
String SubStringTo (const char *string, std::intmax_t startPos=0, bool toLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string up to a string. More...
 
String SubStringTo (const char *string, std::size_t length, std::intmax_t startPos=0, bool toLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string up to a string. More...
 
String SubStringTo (const String &string, std::intmax_t startPos=0, bool toLast=false, bool include=false, UInt32 flags=None) const
 Returns a sub string of the string up to a string. More...
 
void Swap (String &str)
 Swaps the content with the other string. More...
 
bool ToBool (bool *value, UInt32 flags=None) const
 Converts the string to boolean. More...
 
bool ToDouble (double *value) const
 Converts the string to double. More...
 
bool ToInteger (long long *value, UInt8 radix=10) const
 Converts the string to integer. More...
 
String ToLower (UInt32 flags=None) const
 Converts the string to lower. More...
 
String ToUpper (UInt32 flags=None) const
 Converts the string to upper. More...
 
StringTrim (UInt32 flags=None)
 Trims the string. More...
 
StringTrim (char character, UInt32 flags=None)
 Trims the string from a character. More...
 
String Trimmed (UInt32 flags=None) const
 Trims a copy of the string. More...
 
String Trimmed (char character, UInt32 flags=None) const
 Trims a copy of the string from a character. More...
 
char * begin ()
 Returns an iterator pointing to the beginning of the string. More...
 
const char * begin () const
 Returns an iterator pointing to the beginning of the string. More...
 
char * end ()
 Returns an iterator pointing to the end of the string. More...
 
const char * end () const
 Returns an iterator pointing to the end of the string. More...
 
void push_front (char c)
 Pushed the character to the front of the string. More...
 
void push_back (char c)
 Pushed the character to the back of the string. More...
 
 operator std::string () const
 Converts the string to std::string. More...
 
char & operator[] (std::size_t pos)
 Gets the ith character in the string. More...
 
char operator[] (std::size_t pos) const
 Gets the ith character in the string. More...
 
Stringoperator= (char character)
 Assigns the string to the character. More...
 
Stringoperator= (const char *string)
 Assigns the string with other "C string". More...
 
Stringoperator= (const std::string &string)
 Assigns the string with a std::string. More...
 
Stringoperator= (const String &string)
 Assigns the string with other string. More...
 
Stringoperator= (String &&string) noexcept
 Assigns the string by move semantic. More...
 
String operator+ (char character) const
 Concatenates the character to the string. More...
 
String operator+ (const char *string) const
 Concatenates the "C string" to the string. More...
 
String operator+ (const std::string &string) const
 Concatenates the std::string to the string. More...
 
String operator+ (const String &string) const
 Concatenates the string to the string. More...
 
Stringoperator+= (char character)
 Concatenates the character to this string. More...
 
Stringoperator+= (const char *string)
 Concatenates the "C string" to this string. More...
 
Stringoperator+= (const std::string &string)
 Concatenates the std::string to this string. More...
 
Stringoperator+= (const String &string)
 Concatenates the string to this string. More...
 
bool operator== (char character) const
 Checks whether the string is equal to the character. More...
 
bool operator== (const char *string) const
 Checks whether the string is equal to the "C string". More...
 
bool operator== (const std::string &string) const
 Checks whether the string is equal to the std::string. More...
 
bool operator!= (char character) const
 Checks whether the string is equal to the character. More...
 
bool operator!= (const char *string) const
 Checks whether the string is equal to the "C string". More...
 
bool operator!= (const std::string &string) const
 Checks whether the string is equal to the std::string. More...
 
bool operator< (char character) const
 Checks whether the string is less than the character. More...
 
bool operator< (const char *string) const
 Checks whether the string is less than the "C string". More...
 
bool operator< (const std::string &string) const
 Checks whether the string is less than the std::string. More...
 
bool operator<= (char character) const
 Checks whether the string is less or equal than the character. More...
 
bool operator<= (const char *string) const
 Checks whether the string is less or equal than the "C string". More...
 
bool operator<= (const std::string &string) const
 Checks whether the string is less or equal than the std::string. More...
 
bool operator> (char character) const
 Checks whether the string is greather than the character. More...
 
bool operator> (const char *string) const
 Checks whether the string is greather than the "C string". More...
 
bool operator> (const std::string &string) const
 Checks whether the string is greather than the std::string. More...
 
bool operator>= (char character) const
 Checks whether the string is greather or equal than the character. More...
 
bool operator>= (const char *string) const
 Checks whether the string is greather or equal than the "C string". More...
 
bool operator>= (const std::string &string) const
 Checks whether the string is greather or equal than the std::string. More...
 

Static Public Member Functions

static String Boolean (bool boolean)
 Converts the boolean to string. More...
 
static int Compare (const String &first, const String &second)
 Lexicographically compares the string. More...
 
static String Format (const char *format,...)
 Build a string using a format and returns it. More...
 
static String FormatVA (const char *format, va_list arg)
 Build a string using a format and returns it. More...
 
static String Number (float number)
 Converts the number to string. More...
 
static String Number (double number)
 Converts the number to string. More...
 
static String Number (long double number)
 Converts the number to string. More...
 
static String Number (signed char number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (unsigned char number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (short number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (unsigned short number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (int number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (unsigned int number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (long number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (unsigned long number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (long long number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Number (unsigned long long number, UInt8 radix=10)
 Converts the number to string. More...
 
static String Pointer (const void *ptr)
 Converts the pointer to string. More...
 
static String Unicode (char32_t character)
 Converts the unicode point to string. More...
 
static String Unicode (const char *u8String)
 Converts the unicode "C string" to string. More...
 
static String Unicode (const char16_t *u16String)
 Converts the unicode "C string" to string. More...
 
static String Unicode (const char32_t *u32String)
 Converts the unicode "C string" to string. More...
 
static String Unicode (const wchar_t *wString)
 Converts the unicode "C string" to string. More...
 

Static Public Attributes

static const std::size_t npos
 

Friends

NAZARA_CORE_API friend std::istream & operator>> (std::istream &in, String &string)
 Inputs the stream into the string. More...
 
NAZARA_CORE_API friend std::ostream & operator<< (std::ostream &out, const String &string)
 Output operator. More...
 
NAZARA_CORE_API friend String operator+ (char character, const String &string)
 Concatenates the character to the string. More...
 
NAZARA_CORE_API friend String operator+ (const char *string, const String &nstring)
 Concatenates the "C string" to the string. More...
 
NAZARA_CORE_API friend String operator+ (const std::string &string, const String &nstring)
 Concatenates the std::string to the string. More...
 
NAZARA_CORE_API friend bool operator== (const String &first, const String &second)
 Checks whether the first string is equal to the second string. More...
 
NAZARA_CORE_API friend bool operator!= (const String &first, const String &second)
 Checks whether the first string is equal to the second string. More...
 
NAZARA_CORE_API friend bool operator< (const String &first, const String &second)
 Checks whether the first string is less than the second string. More...
 
NAZARA_CORE_API friend bool operator<= (const String &first, const String &second)
 Checks whether the first string is less or equal than the second string. More...
 
NAZARA_CORE_API friend bool operator> (const String &first, const String &second)
 Checks whether the first string is greather than the second string. More...
 
NAZARA_CORE_API friend bool operator>= (const String &first, const String &second)
 Checks whether the first string is greather or equal than the second string. More...
 
NAZARA_CORE_API friend bool operator== (char character, const String &nstring)
 Checks whether the string is equal to the character. More...
 
NAZARA_CORE_API friend bool operator== (const char *string, const String &nstring)
 Checks whether the string is equal to the "C string". More...
 
NAZARA_CORE_API friend bool operator== (const std::string &string, const String &nstring)
 Checks whether the string is equal to the std::string. More...
 
NAZARA_CORE_API friend bool operator!= (char character, const String &nstring)
 Checks whether the string is equal to the character. More...
 
NAZARA_CORE_API friend bool operator!= (const char *string, const String &nstring)
 Checks whether the string is equal to the "C string". More...
 
NAZARA_CORE_API friend bool operator!= (const std::string &string, const String &nstring)
 Checks whether the string is equal to the std::string. More...
 
NAZARA_CORE_API friend bool operator< (char character, const String &nstring)
 Checks whether the string is less than the character. More...
 
NAZARA_CORE_API friend bool operator< (const char *string, const String &nstring)
 Checks whether the string is less than the "C string". More...
 
NAZARA_CORE_API friend bool operator< (const std::string &string, const String &nstring)
 Checks whether the string is less than the std::string. More...
 
NAZARA_CORE_API friend bool operator<= (char character, const String &nstring)
 Checks whether the string is less or equal than the character. More...
 
NAZARA_CORE_API friend bool operator<= (const char *string, const String &nstring)
 Checks whether the string is less or equal than the "C string". More...
 
NAZARA_CORE_API friend bool operator<= (const std::string &string, const String &nstring)
 Checks whether the string is less or equal than the std::string. More...
 
NAZARA_CORE_API friend bool operator> (char character, const String &nstring)
 Checks whether the string is greather than the character. More...
 
NAZARA_CORE_API friend bool operator> (const char *string, const String &nstring)
 Checks whether the string is greather than the "C string". More...
 
NAZARA_CORE_API friend bool operator> (const std::string &string, const String &nstring)
 Checks whether the string is greather than the std::string. More...
 
NAZARA_CORE_API friend bool operator>= (char character, const String &nstring)
 Checks whether the string is greather or equal than the character. More...
 
NAZARA_CORE_API friend bool operator>= (const char *string, const String &nstring)
 Checks whether the string is greather or equal than the "C string". More...
 
NAZARA_CORE_API friend bool operator>= (const std::string &string, const String &nstring)
 Checks whether the string is greather or equal than the std::string. More...
 

Detailed Description

Core class that represents a string.

Constructor & Destructor Documentation

◆ String() [1/8]

Nz::String::String ( char  character)
explicit

Constructs a String object with a character.

Parameters
characterSingle character

◆ String() [2/8]

Nz::String::String ( std::size_t  rep,
char  character 
)

Constructs a String object with multiple times the same character.

Parameters
repNumber of repetitions of the character
characterSingle character

◆ String() [3/8]

Nz::String::String ( std::size_t  rep,
const char *  string 
)

Constructs a String object with multiple times the same string.

Parameters
repNumber of repetitions of the string
stringString to multiply

◆ String() [4/8]

Nz::String::String ( std::size_t  rep,
const char *  string,
std::size_t  length 
)

Constructs a String object with multiple times the same string.

Parameters
repNumber of repetitions of the string
stringString to multiply
lengthLength of the string

◆ String() [5/8]

Nz::String::String ( std::size_t  rep,
const String string 
)

Constructs a String object with multiple times the same string.

Parameters
repNumber of repetitions of the string
stringString to multiply

◆ String() [6/8]

Nz::String::String ( const char *  string)

Constructs a String object with a "C string".

Parameters
stringString to represent

◆ String() [7/8]

Nz::String::String ( const char *  string,
std::size_t  length 
)

Constructs a String object with a "C string".

Parameters
stringString to represent
lengthLength of the string

◆ String() [8/8]

Nz::String::String ( const std::string &  string)

Constructs a String object which is a copy of another.

Parameters
stringString to copy

Member Function Documentation

◆ Append() [1/4]

String & Nz::String::Append ( char  character)

Appends the character to the string.

Returns
A reference to this
Parameters
characterSingle character
See also
Insert

◆ Append() [2/4]

String & Nz::String::Append ( const char *  string)

Appends the "C string" to the string.

Returns
A reference to this
Parameters
stringString to add
See also
Insert

◆ Append() [3/4]

String & Nz::String::Append ( const char *  string,
std::size_t  length 
)

Appends the "C string" to the string.

Returns
A reference to this
Parameters
stringString to add
lengthSize of the string
See also
Insert

◆ Append() [4/4]

String & Nz::String::Append ( const String string)

Appends the string to the string.

Returns
A reference to this
Parameters
stringString to add
See also
Insert

◆ begin() [1/2]

char * Nz::String::begin ( )

Returns an iterator pointing to the beginning of the string.

Returns
beginning of the string

◆ begin() [2/2]

const char * Nz::String::begin ( ) const

Returns an iterator pointing to the beginning of the string.

Returns
beginning of the string

◆ Boolean()

String Nz::String::Boolean ( bool  boolean)
static

Converts the boolean to string.

Returns
String representation of the boolean
Parameters
booleanBoolean value

◆ Clear()

void Nz::String::Clear ( bool  keepBuffer = false)

Clears the content of the string.

Parameters
keepBufferShould the buffer be kept

◆ Compare()

int Nz::String::Compare ( const String first,
const String second 
)
static

Lexicographically compares the string.

Returns
The expected result
Parameters
firstFirst string to use for comparison
secondSecond string to use for comparison

◆ Contains() [1/3]

bool Nz::String::Contains ( char  character,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Checks whether the string contains the character

Returns
true if found in the string
Parameters
characterSingle character
startIndex to begin the research
flagsFlag for the look up
See also
Find

◆ Contains() [2/3]

bool Nz::String::Contains ( const char *  string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Checks whether the string contains the "C string"

Returns
true if found in the string
Parameters
stringString to search
startIndex to begin the research
flagsFlag for the look up
See also
Find

◆ Contains() [3/3]

bool Nz::String::Contains ( const String string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Checks whether the string contains the string

Returns
true if found in the string
Parameters
stringString to search
startIndex to begin the research
flagsFlag for the look up
See also
Find

◆ Count() [1/3]

unsigned int Nz::String::Count ( char  character,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Counts the number of occurrences in the string.

Returns
Number of occurrences
Parameters
characterSingle character
startIndex to begin the research
flagsFlag for the look up

◆ Count() [2/3]

unsigned int Nz::String::Count ( const char *  string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Counts the number of occurrences in the string.

Returns
Number of occurrences
Parameters
stringString to count
startIndex to begin the research
flagsFlag for the look up

◆ Count() [3/3]

unsigned int Nz::String::Count ( const String string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Counts the number of occurrences in the string.

Returns
Number of occurrences
Parameters
stringString to count
startIndex to begin the research
flagsFlag for the look up

◆ CountAny() [1/2]

unsigned int Nz::String::CountAny ( const char *  string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Counts the number of occurrences of any characters in the list in the string.

Returns
Number of occurrences
Parameters
stringString to match
startIndex to begin the research
flagsFlag for the look up

◆ CountAny() [2/2]

unsigned int Nz::String::CountAny ( const String string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Counts the number of occurrences of any characters in the list in the string.

Returns
Number of occurrences
Parameters
stringString to match
startIndex to begin the research
flagsFlag for the look up

◆ end() [1/2]

char * Nz::String::end ( )

Returns an iterator pointing to the end of the string.

Returns
End of the string

◆ end() [2/2]

const char * Nz::String::end ( ) const

Returns an iterator pointing to the end of the string.

Returns
End of the string

◆ EndsWith() [1/4]

bool Nz::String::EndsWith ( char  character,
UInt32  flags = None 
) const

Checks whether the string ends with the character.

Returns
true if it the case
Parameters
characterSingle character
flagsFlag for the look up
See also
StartsWith

◆ EndsWith() [2/4]

bool Nz::String::EndsWith ( const char *  string,
UInt32  flags = None 
) const

Checks whether the string ends with the "C string".

Returns
true if it the case
Parameters
stringString to match
flagsFlag for the look up
See also
StartsWith

◆ EndsWith() [3/4]

bool Nz::String::EndsWith ( const char *  string,
std::size_t  length,
UInt32  flags = None 
) const

Checks whether the string ends with the "C string".

Returns
true if it the case
Parameters
stringString to match
lengthSize of the string
flagsFlag for the look up
See also
StartsWith

◆ EndsWith() [4/4]

bool Nz::String::EndsWith ( const String string,
UInt32  flags = None 
) const

Checks whether the string ends with the string.

Returns
true if it the case
Parameters
stringString to match
flagsFlag for the look up
See also
StartsWith

◆ Find() [1/3]

std::size_t Nz::String::Find ( char  character,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first index of the character in the string.

Returns
Index in the string
Parameters
characterSingle character
startIndex to begin the search
flagsFlag for the look up

◆ Find() [2/3]

std::size_t Nz::String::Find ( const char *  string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first index of the "C string" in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

◆ Find() [3/3]

std::size_t Nz::String::Find ( const String string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first index of the string in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

◆ FindAny() [1/2]

std::size_t Nz::String::FindAny ( const char *  string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first index of any characters in the list in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

◆ FindAny() [2/2]

std::size_t Nz::String::FindAny ( const String string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first index of any characters in the list in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

◆ FindLast() [1/3]

std::size_t Nz::String::FindLast ( char  character,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last index of the character in the string.

Returns
Index in the string
Parameters
characterSingle character
startIndex to begin the search
flagsFlag for the look up

◆ FindLast() [2/3]

std::size_t Nz::String::FindLast ( const char *  string,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last index of the "C string" in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

Algo 1.FindLast#3 (Size of the pattern unknown)

◆ FindLast() [3/3]

std::size_t Nz::String::FindLast ( const String string,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last index of the string in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

Algo 1.FindLast#3 (Iterator non-adapted)

Algo 1.FindLast#4 (Size of the pattern unknown)

Algo 1.FindLast#4 (Size of the pattern known)

◆ FindLastAny() [1/2]

std::size_t Nz::String::FindLastAny ( const char *  string,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last index of any characters in the list in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

◆ FindLastAny() [2/2]

std::size_t Nz::String::FindLastAny ( const String string,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last index of any characters in the list in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

◆ FindLastWord() [1/2]

std::size_t Nz::String::FindLastWord ( const char *  string,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last word in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

Algo 2.FindLastWord#1 (Size of the pattern unknown)

◆ FindLastWord() [2/2]

std::size_t Nz::String::FindLastWord ( const String string,
std::intmax_t  start = -1,
UInt32  flags = None 
) const

Finds the last word in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

Algo 2.FindLastWord#2 (Size of the pattern known)

◆ FindWord() [1/2]

std::size_t Nz::String::FindWord ( const char *  string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first word in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

Algo 3.FindWord#3 (Size of the pattern unknown)

◆ FindWord() [2/2]

std::size_t Nz::String::FindWord ( const String string,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Finds the first word in the string.

Returns
Index in the string
Parameters
stringString to match
startIndex to begin the search
flagsFlag for the look up

Algo 3.FindWord#3 (Iterator too slow for #2)

Algo 3.FindWord#2 (Size of the pattern known)

◆ Format()

String Nz::String::Format ( const char *  format,
  ... 
)
inlinestatic

Build a string using a format and returns it.

Returns
Formatted string
Parameters
formatString format
...Format arguments

◆ FormatVA()

String Nz::String::FormatVA ( const char *  format,
va_list  args 
)
static

Build a string using a format and returns it.

Returns
Formatted string
Parameters
formatString format
argsFormat arguments

◆ GetBuffer()

char * Nz::String::GetBuffer ( )

Gets the raw buffer.

Returns
Raw buffer

◆ GetCapacity()

std::size_t Nz::String::GetCapacity ( ) const

Gets the capacity of the string.

Returns
Capacity of the string

◆ GetCharacterPosition()

std::size_t Nz::String::GetCharacterPosition ( std::size_t  characterIndex) const

Gets the index where a character begin.

Iterate through the string to find the starting position of a specific character index This is useful because non-ASCII characters may be encoded using multiple bytes.

Parameters
characterIndexIndex of the character to search for
Returns
Starting index

◆ GetConstBuffer()

const char * Nz::String::GetConstBuffer ( ) const

Gets the raw buffer.

Returns
Raw buffer

◆ GetLength()

std::size_t Nz::String::GetLength ( ) const

Gets the length of the string.

Returns
Length of the string with UTF-8 awareness

◆ GetSize()

std::size_t Nz::String::GetSize ( ) const

Gets the size of the string.

Returns
Size of the string without UTF-8 awareness

◆ GetUtf16String()

std::u16string Nz::String::GetUtf16String ( ) const

Gets the std::string corresponding.

Returns
String in UTF-16

◆ GetUtf32String()

std::u32string Nz::String::GetUtf32String ( ) const

Gets the std::string corresponding.

Returns
String in UTF-32

◆ GetUtf8String()

std::string Nz::String::GetUtf8String ( ) const

Gets the std::string corresponding.

Returns
String in UTF-8

◆ GetWideString()

std::wstring Nz::String::GetWideString ( ) const

Gets the std::wstring corresponding.

Returns
String in Wide

◆ GetWord()

String Nz::String::GetWord ( unsigned int  index,
UInt32  flags = None 
) const

Gets the word until next separator.

Returns
Word string
Parameters
startIndex to begin the search
flagsFlag for the look up

◆ GetWordPosition()

std::size_t Nz::String::GetWordPosition ( unsigned int  index,
UInt32  flags = None 
) const

Gets the word position.

Returns
Position of the beginning of the word
Parameters
startIndex to begin the search
flagsFlag for the look up

◆ Insert() [1/4]

String & Nz::String::Insert ( std::intmax_t  pos,
char  character 
)

Inserts the character into the string.

Returns
A reference to this
Parameters
posPosition in the string
characterSingle character

◆ Insert() [2/4]

String & Nz::String::Insert ( std::intmax_t  pos,
const char *  string 
)

Inserts the "C string" into the string.

Returns
A reference to this
Parameters
posPosition in the string
stringString to add

◆ Insert() [3/4]

String & Nz::String::Insert ( std::intmax_t  pos,
const char *  string,
std::size_t  length 
)

Inserts the "C string" into the string.

Returns
A reference to this
Parameters
posPosition in the string
stringString to add
lengthSize of the string

◆ Insert() [4/4]

String & Nz::String::Insert ( std::intmax_t  pos,
const String string 
)

Inserts the string into the string.

Returns
A reference to this
Parameters
posPosition in the string
stringString to add

◆ IsEmpty()

bool Nz::String::IsEmpty ( ) const

Checks whether the string is empty.

Returns
true if string is empty

◆ IsNull()

bool Nz::String::IsNull ( ) const

Checks whether the string is null.

Returns
true if string is null

◆ IsNumber()

bool Nz::String::IsNumber ( UInt8  base = 10,
UInt32  flags = CaseInsensitive 
) const

Checks whether the string is a number.

Returns
true if string is a number
Parameters
baseBase of the number
flagsFlag for the look up
Remarks
Produces a NazaraError if base is not in [2, 36( with NAZARA_CORE_SAFE defined

◆ Match() [1/2]

bool Nz::String::Match ( const char *  pattern) const

Checks whether the string matches the pattern.

Returns
true if string matches
Parameters
patternPattern to search

◆ Match() [2/2]

bool Nz::String::Match ( const String pattern) const

Checks whether the string matches the pattern.

Returns
true if string matches
Parameters
patternPattern to search

◆ Number() [1/13]

String Nz::String::Number ( float  number)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberFloat value

◆ Number() [2/13]

String Nz::String::Number ( double  number)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberDouble value

◆ Number() [3/13]

String Nz::String::Number ( long double  number)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberLong double value

◆ Number() [4/13]

String Nz::String::Number ( signed char  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberSigned char value
radixBase of the number

◆ Number() [5/13]

String Nz::String::Number ( unsigned char  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberUnsigned char value
radixBase of the number

◆ Number() [6/13]

String Nz::String::Number ( short  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberShort value
radixBase of the number

◆ Number() [7/13]

String Nz::String::Number ( unsigned short  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberUnsigned short value
radixBase of the number

◆ Number() [8/13]

String Nz::String::Number ( int  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberInt value
radixBase of the number

◆ Number() [9/13]

String Nz::String::Number ( unsigned int  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberUnsigned int value
radixBase of the number

◆ Number() [10/13]

String Nz::String::Number ( long  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberLong value
radixBase of the number

◆ Number() [11/13]

String Nz::String::Number ( unsigned long  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberUnsigned long value
radixBase of the number

◆ Number() [12/13]

String Nz::String::Number ( long long  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberLong long value
radixBase of the number

◆ Number() [13/13]

String Nz::String::Number ( unsigned long long  number,
UInt8  radix = 10 
)
static

Converts the number to string.

Returns
String representation of the number
Parameters
numberUnsigned long long value
radixBase of the number

◆ operator std::string()

Nz::String::operator std::string ( ) const

Converts the string to std::string.

Returns
std::string representation

◆ operator!=() [1/3]

bool Nz::String::operator!= ( char  character) const

Checks whether the string is equal to the character.

Returns
false if it is the case
Parameters
characterSingle character

◆ operator!=() [2/3]

bool Nz::String::operator!= ( const char *  string) const

Checks whether the string is equal to the "C string".

Returns
false if it is the case
Parameters
stringString to compare

◆ operator!=() [3/3]

bool Nz::String::operator!= ( const std::string &  string) const

Checks whether the string is equal to the std::string.

Returns
false if it is the case
Parameters
stringString to compare

◆ operator+() [1/4]

String Nz::String::operator+ ( char  character) const

Concatenates the character to the string.

Returns
String which is the result of the concatenation
Parameters
characterSingle character

◆ operator+() [2/4]

String Nz::String::operator+ ( const char *  string) const

Concatenates the "C string" to the string.

Returns
String which is the result of the concatenation
Parameters
stringString to add

◆ operator+() [3/4]

String Nz::String::operator+ ( const std::string &  string) const

Concatenates the std::string to the string.

Returns
String which is the result of the concatenation
Parameters
stringString to add

◆ operator+() [4/4]

String Nz::String::operator+ ( const String string) const

Concatenates the string to the string.

Returns
String which is the result of the concatenation
Parameters
stringString to add

◆ operator+=() [1/4]

String & Nz::String::operator+= ( char  character)

Concatenates the character to this string.

Returns
A reference to this
Parameters
characterSingle character

◆ operator+=() [2/4]

String & Nz::String::operator+= ( const char *  string)

Concatenates the "C string" to this string.

Returns
A reference to this
Parameters
stringString to add

◆ operator+=() [3/4]

String & Nz::String::operator+= ( const std::string &  string)

Concatenates the std::string to this string.

Returns
A reference to this
Parameters
stringString to add

◆ operator+=() [4/4]

String & Nz::String::operator+= ( const String string)

Concatenates the string to this string.

Returns
A reference to this
Parameters
stringString to add

◆ operator<() [1/3]

bool Nz::String::operator< ( char  character) const

Checks whether the string is less than the character.

Returns
true if it is the case
Parameters
characterSingle character

◆ operator<() [2/3]

bool Nz::String::operator< ( const char *  string) const

Checks whether the string is less than the "C string".

Returns
true if it is the case
Parameters
stringString to compare

◆ operator<() [3/3]

bool Nz::String::operator< ( const std::string &  string) const

Checks whether the string is less than the std::string.

Returns
true if it is the case
Parameters
stringString to compare

◆ operator<=() [1/3]

bool Nz::String::operator<= ( char  character) const

Checks whether the string is less or equal than the character.

Returns
true if it is the case
Parameters
characterSingle character

◆ operator<=() [2/3]

bool Nz::String::operator<= ( const char *  string) const

Checks whether the string is less or equal than the "C string".

Returns
true if it is the case
Parameters
stringString to compare

◆ operator<=() [3/3]

bool Nz::String::operator<= ( const std::string &  string) const

Checks whether the string is less or equal than the std::string.

Returns
true if it is the case
Parameters
stringString to compare

◆ operator=() [1/5]

String & Nz::String::operator= ( char  character)

Assigns the string to the character.

Returns
A reference to this
Parameters
characterSingle character

◆ operator=() [2/5]

String & Nz::String::operator= ( const char *  string)

Assigns the string with other "C string".

Returns
A reference to this
Parameters
stringString to copy

◆ operator=() [3/5]

String & Nz::String::operator= ( const std::string &  string)

Assigns the string with a std::string.

Returns
A reference to this
Parameters
stringString to copy

◆ operator=() [4/5]

String & Nz::String::operator= ( const String string)

Assigns the string with other string.

Returns
A reference to this
Parameters
stringString to copy

◆ operator=() [5/5]

String & Nz::String::operator= ( String &&  string)
noexcept

Assigns the string by move semantic.

Returns
A reference to this
Parameters
stringString to move

◆ operator==() [1/3]

bool Nz::String::operator== ( char  character) const

Checks whether the string is equal to the character.

Returns
true if it is the case
Parameters
characterSingle character

◆ operator==() [2/3]

bool Nz::String::operator== ( const char *  string) const

Checks whether the string is equal to the "C string".

Returns
true if it is the case
Parameters
stringString to compare

◆ operator==() [3/3]

bool Nz::String::operator== ( const std::string &  string) const

Checks whether the string is equal to the std::string.

Returns
true if it is the case
Parameters
stringString to compare

◆ operator>() [1/3]

bool Nz::String::operator> ( char  character) const

Checks whether the string is greather than the character.

Returns
true if it is the case
Parameters
characterSingle character

◆ operator>() [2/3]

bool Nz::String::operator> ( const char *  string) const

Checks whether the string is greather than the "C string".

Returns
true if it is the case
Parameters
stringString to compare

◆ operator>() [3/3]

bool Nz::String::operator> ( const std::string &  string) const

Checks whether the string is greather than the std::string.

Returns
true if it is the case
Parameters
stringString to compare

◆ operator>=() [1/3]

bool Nz::String::operator>= ( char  character) const

Checks whether the string is greather or equal than the character.

Returns
true if it is the case
Parameters
characterSingle character

◆ operator>=() [2/3]

bool Nz::String::operator>= ( const char *  string) const

Checks whether the string is greather or equal than the "C string".

Returns
true if it is the case
Parameters
stringString to compare

◆ operator>=() [3/3]

bool Nz::String::operator>= ( const std::string &  string) const

Checks whether the string is greather or equal than the std::string.

Returns
true if it is the case
Parameters
stringString to compare

◆ operator[]() [1/2]

char & Nz::String::operator[] ( std::size_t  pos)

Gets the ith character in the string.

Returns
A reference to the character
Parameters
posIndex of the character
Remarks
If pos is greather than the size, Resize is called

◆ operator[]() [2/2]

char Nz::String::operator[] ( std::size_t  pos) const

Gets the ith character in the string.

Returns
The character
Parameters
posIndex of the character
Remarks
Produces a NazaraError if pos is greather than the size

◆ Pointer()

String Nz::String::Pointer ( const void *  ptr)
static

Converts the pointer to string.

Returns
String representation of the pointer
Parameters
ptrPointer to represent

◆ Prepend() [1/4]

String & Nz::String::Prepend ( char  character)

Prepends the character to the string.

Returns
A reference to this
Parameters
characterSingle character
See also
Insert

◆ Prepend() [2/4]

String & Nz::String::Prepend ( const char *  string)

Prepends the "C string" to the string.

Returns
A reference to this
Parameters
stringString to add
See also
Insert

◆ Prepend() [3/4]

String & Nz::String::Prepend ( const char *  string,
std::size_t  length 
)

Prepends the "C string" to the string.

Returns
A reference to this
Parameters
stringString to add
lengthSize of the string
See also
Insert

◆ Prepend() [4/4]

String & Nz::String::Prepend ( const String string)

Prepends the string to the string.

Returns
A reference to this
Parameters
stringString to add
See also
Insert

◆ push_back()

void Nz::String::push_back ( char  c)

Pushed the character to the back of the string.

Parameters
cSingle character
See also
Append

◆ push_front()

void Nz::String::push_front ( char  c)

Pushed the character to the front of the string.

Parameters
cSingle character
See also
Prepend

◆ Replace() [1/4]

unsigned int Nz::String::Replace ( char  oldCharacter,
char  newCharacter,
std::intmax_t  start = 0,
UInt32  flags = None 
)

Replaces the old character by the new one.

Returns
Number of changes
Parameters
oldCharacterPattern to find
newCharacterPattern to change for
startIndex to begin the search
flagsFlag for the look up

◆ Replace() [2/4]

unsigned int Nz::String::Replace ( const char *  oldString,
const char *  replaceString,
std::intmax_t  start = 0,
UInt32  flags = None 
)

Replaces the old "C string" by the new one.

Returns
Number of changes
Parameters
oldCharacterPattern to find
newCharacterPattern to change for
startIndex to begin the search
flagsFlag for the look up

◆ Replace() [3/4]

unsigned int Nz::String::Replace ( const char *  oldString,
std::size_t  oldLength,
const char *  replaceString,
std::size_t  replaceLength,
std::intmax_t  start = 0,
UInt32  flags = None 
)

Replaces the old "C string" by the new one.

Returns
Number of changes
Parameters
oldCharacterPattern to find
oldLengthLength of the old string
newCharacterPattern to change for
Lengthof the new string
startIndex to begin the search
flagsFlag for the look up

TODO: Replacement algorithm without changing the buffer (if replaceLength < oldLength)

Algo 4.Replace#2

◆ Replace() [4/4]

unsigned int Nz::String::Replace ( const String oldString,
const String replaceString,
std::intmax_t  start = 0,
UInt32  flags = None 
)

Replaces the old string by the new one.

Returns
Number of changes
Parameters
oldCharacterPattern to find
newCharacterPattern to change for
startIndex to begin the search
flagsFlag for the look up

◆ ReplaceAny()

unsigned int Nz::String::ReplaceAny ( const char *  oldCharacters,
char  replaceCharacter,
std::intmax_t  start = 0,
UInt32  flags = None 
)

Replaces the old characters in the list by the new one.

Returns
Number of changes
Parameters
oldCharactersPattern to find
newCharacterPattern to change for
startIndex to begin the search
flagsFlag for the look up
Remarks
Does not handle UTF-8 currently

FIXME: Does not handle UTF-8

◆ Reserve()

void Nz::String::Reserve ( std::size_t  bufferSize)

Reserves enough memory for the buffer size.

Parameters
bufferSizeSize of the buffer to allocate
Remarks
If bufferSize is smaller than the old one, nothing is done

◆ Resize()

String & Nz::String::Resize ( std::intmax_t  size,
UInt32  flags = None 
)

Resizes the string.

Returns
A reference to this
Parameters
sizeTarget size
flagsFlag for the look up

◆ Resized()

String Nz::String::Resized ( std::intmax_t  size,
UInt32  flags = None 
) const

Resize a copy of the string.

Returns
A copy of what would be the string resized
Parameters
sizeTarget size
flagsFlag for the look up

◆ Reverse()

String & Nz::String::Reverse ( )

Reverses the string.

Returns
A reference to this

◆ Reversed()

String Nz::String::Reversed ( ) const

Reverses a copy of the string.

Returns
A copy of what would be the string reversed

◆ Set() [1/10]

String & Nz::String::Set ( char  character)

Sets the string to the character.

Returns
A reference to this
Parameters
characterSingle character

◆ Set() [2/10]

String & Nz::String::Set ( std::size_t  rep,
char  character 
)

Sets the string with multiple times the same character.

Returns
A reference to this
Parameters
repNumber of repetitions of the character
characterSingle character

◆ Set() [3/10]

String & Nz::String::Set ( std::size_t  rep,
const char *  string 
)

Sets the string with multiple times the same string.

Returns
A reference to this
Parameters
repNumber of repetitions of the string
stringString to multiply

◆ Set() [4/10]

String & Nz::String::Set ( std::size_t  rep,
const char *  string,
std::size_t  length 
)

Sets the string with multiple times the same string.

Returns
A reference to this
Parameters
repNumber of repetitions of the string
stringString to multiply
lengthLength of the string

◆ Set() [5/10]

String & Nz::String::Set ( std::size_t  rep,
const String string 
)

Sets the string with multiple times the same string.

Returns
A reference to this
Parameters
repNumber of repetitions of the string
stringString to multiply

◆ Set() [6/10]

String & Nz::String::Set ( const char *  string)

Sets the string with other "C string".

Returns
A reference to this
Parameters
stringString to copy

◆ Set() [7/10]

String & Nz::String::Set ( const char *  string,
std::size_t  length 
)

Sets the string with other "C string".

Returns
A reference to this
Parameters
stringString to represent
lengthLength of the string

◆ Set() [8/10]

String & Nz::String::Set ( const std::string &  string)

Sets the string with a std::string.

Returns
A reference to this
Parameters
stringString to copy

◆ Set() [9/10]

String & Nz::String::Set ( const String string)

Sets the string with other string.

Returns
A reference to this
Parameters
stringString to copy

◆ Set() [10/10]

String & Nz::String::Set ( String &&  string)
noexcept

Sets the string by move semantic.

Returns
A reference to this
Parameters
stringString to move

◆ Simplified()

String Nz::String::Simplified ( UInt32  flags = None) const

Simplifies a copy of the string.

Returns
A copy of what would be the string simplified
Parameters
flagsFlag for the look up

◆ Simplify()

String & Nz::String::Simplify ( UInt32  flags = None)

Simplifies the string.

Returns
A reference to this
Parameters
flagsFlag for the look up

◆ Split() [1/4]

unsigned int Nz::String::Split ( std::vector< String > &  result,
char  separation = ' ',
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Splits the string into others.

Returns
The number of splits
Parameters
resultResulting tokens
separationSeparation character
startIndex for the beginning of the search
flagsFlag for the look up

◆ Split() [2/4]

unsigned int Nz::String::Split ( std::vector< String > &  result,
const char *  separation,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Splits the string into others.

Returns
The number of splits
Parameters
resultResulting tokens
separationSeparation string
startIndex for the beginning of the search
flagsFlag for the look up

◆ Split() [3/4]

unsigned int Nz::String::Split ( std::vector< String > &  result,
const char *  separation,
std::size_t  length,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Splits the string into others.

Returns
The number of splits
Parameters
resultResulting tokens
separationSeparation String
lengthLength of the string
startIndex for the beginning of the search
flagsFlag for the look up

◆ Split() [4/4]

unsigned int Nz::String::Split ( std::vector< String > &  result,
const String separation,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Splits the string into others.

Returns
The number of splits
Parameters
resultResulting tokens
separationSeparation string
startIndex for the beginning of the search
flagsFlag for the look up

◆ SplitAny() [1/2]

unsigned int Nz::String::SplitAny ( std::vector< String > &  result,
const char *  separations,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Splits the string into others.

Returns
The number of splits
Parameters
resultResulting tokens
separationList of characters of separation
startIndex for the beginning of the search
flagsFlag for the look up

◆ SplitAny() [2/2]

unsigned int Nz::String::SplitAny ( std::vector< String > &  result,
const String separations,
std::intmax_t  start = 0,
UInt32  flags = None 
) const

Splits the string into others.

Returns
The number of splits
Parameters
resultResulting tokens
separationList of characters of separation
startIndex for the beginning of the search
flagsFlag for the look up

◆ StartsWith() [1/3]

bool Nz::String::StartsWith ( char  character,
UInt32  flags = None 
) const

Checks whether the string begins with the character.

Returns
true if it the case
Parameters
characterSingle character
flagsFlag for the look up
See also
EndsWith

◆ StartsWith() [2/3]

bool Nz::String::StartsWith ( const char *  string,
UInt32  flags = None 
) const

Checks whether the string begins with the "C string".

Returns
true if it the case
Parameters
stringString to match
flagsFlag for the look up
See also
EndsWith

◆ StartsWith() [3/3]

bool Nz::String::StartsWith ( const String string,
UInt32  flags = None 
) const

Checks whether the string begins with the string.

Returns
true if it the case
Parameters
stringString to match
flagsFlag for the look up
See also
EndsWith

◆ SubString()

String Nz::String::SubString ( std::intmax_t  startPos,
std::intmax_t  endPos = -1 
) const

Returns a sub string of the string.

Returns
SubString
Parameters
startPosIndex for the beginning of the search
endPosIndex for the end of the search

◆ SubStringFrom() [1/4]

String Nz::String::SubStringFrom ( char  character,
std::intmax_t  startPos = 0,
bool  fromLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string from a character.

Returns
SubString
Parameters
charaterPattern to find
startPosIndex for the beginning of the search
fromLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringFrom() [2/4]

String Nz::String::SubStringFrom ( const char *  string,
std::intmax_t  startPos = 0,
bool  fromLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string from a string.

Returns
SubString
Parameters
stringPattern to find
startPosIndex for the beginning of the search
fromLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringFrom() [3/4]

String Nz::String::SubStringFrom ( const char *  string,
std::size_t  length,
std::intmax_t  startPos = 0,
bool  fromLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string from a string.

Returns
SubString
Parameters
stringPattern to find
lengthSize of the string
startPosIndex for the beginning of the search
fromLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringFrom() [4/4]

String Nz::String::SubStringFrom ( const String string,
std::intmax_t  startPos = 0,
bool  fromLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string from a string.

Returns
SubString
Parameters
stringPattern to find
startPosIndex for the beginning of the search
fromLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringTo() [1/4]

String Nz::String::SubStringTo ( char  character,
std::intmax_t  startPos = 0,
bool  toLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string up to a character.

Returns
SubString
Parameters
charaterPattern to find
startPosIndex for the beginning of the search
toLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringTo() [2/4]

String Nz::String::SubStringTo ( const char *  string,
std::intmax_t  startPos = 0,
bool  toLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string up to a string.

Returns
SubString
Parameters
stringPattern to find
startPosIndex for the beginning of the search
toLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringTo() [3/4]

String Nz::String::SubStringTo ( const char *  string,
std::size_t  length,
std::intmax_t  startPos = 0,
bool  toLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string up to a string.

Returns
SubString
Parameters
stringPattern to find
lengthSize of the string
startPosIndex for the beginning of the search
toLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ SubStringTo() [4/4]

String Nz::String::SubStringTo ( const String string,
std::intmax_t  startPos = 0,
bool  toLast = false,
bool  include = false,
UInt32  flags = None 
) const

Returns a sub string of the string up to a string.

Returns
SubString
Parameters
stringPattern to find
startPosIndex for the beginning of the search
toLastbeginning by the end
includeInclude the character
flagsFlag for the look up

◆ Swap()

void Nz::String::Swap ( String str)

Swaps the content with the other string.

Parameters
strOther string to swap with

◆ ToBool()

bool Nz::String::ToBool ( bool *  value,
UInt32  flags = None 
) const

Converts the string to boolean.

Returns
true if successful
Parameters
valueBoolean to convert to
flagsFlag for the look up

◆ ToDouble()

bool Nz::String::ToDouble ( double *  value) const

Converts the string to double.

Returns
true if successful
Parameters
valueDouble to convert to
flagsFlag for the look up

◆ ToInteger()

bool Nz::String::ToInteger ( long long *  value,
UInt8  base = 10 
) const

Converts the string to integer.

Returns
true if successful
Parameters
valueInteger to convert to
flagsFlag for the look up

◆ ToLower()

String Nz::String::ToLower ( UInt32  flags = None) const

Converts the string to lower.

Returns
Lower string
Parameters
flagsFlag for the look up

◆ ToUpper()

String Nz::String::ToUpper ( UInt32  flags = None) const

Converts the string to upper.

Returns
Upper string
Parameters
flagsFlag for the look up

◆ Trim() [1/2]

String & Nz::String::Trim ( UInt32  flags = None)

Trims the string.

Returns
A reference to this
Parameters
flagsFlag for the look up

◆ Trim() [2/2]

String & Nz::String::Trim ( char  character,
UInt32  flags = None 
)

Trims the string from a character.

Returns
A reference to this
Parameters
characterCharacter to suppress
flagsFlag for the look up

◆ Trimmed() [1/2]

String Nz::String::Trimmed ( UInt32  flags = None) const

Trims a copy of the string.

Returns
A copy of what would be the string trimmed
Parameters
flagsFlag for the look up

◆ Trimmed() [2/2]

String Nz::String::Trimmed ( char  character,
UInt32  flags = None 
) const

Trims a copy of the string from a character.

Returns
A copy of what would be the string trimmed
Parameters
characterCharacter to suppress
flagsFlag for the look up

◆ Unicode() [1/5]

String Nz::String::Unicode ( char32_t  character)
static

Converts the unicode point to string.

Returns
String representation of the unicode point
Parameters
characterUnicode point

◆ Unicode() [2/5]

String Nz::String::Unicode ( const char *  u8String)
static

Converts the unicode "C string" to string.

Returns
String representation of the unicode "C string"
Parameters
u8StringString in UTF-8

◆ Unicode() [3/5]

String Nz::String::Unicode ( const char16_t *  u16String)
static

Converts the unicode "C string" to string.

Returns
String representation of the unicode "C string"
Parameters
u16StringString in UTF-16

◆ Unicode() [4/5]

String Nz::String::Unicode ( const char32_t *  u32String)
static

Converts the unicode "C string" to string.

Returns
String representation of the unicode "C string"
Parameters
u32StringString in UTF-32

◆ Unicode() [5/5]

String Nz::String::Unicode ( const wchar_t *  wString)
static

Converts the unicode "C string" to string.

Returns
String representation of the unicode "C string"
Parameters
wStringString in Wide

Friends And Related Function Documentation

◆ operator!= [1/4]

NAZARA_CORE_API friend bool operator!= ( const String first,
const String second 
)
friend

Checks whether the first string is equal to the second string.

Returns
false if it is the case
Parameters
firstString to compare in left hand side
secondString to compare in right hand side

◆ operator!= [2/4]

NAZARA_CORE_API friend bool operator!= ( char  character,
const String nstring 
)
friend

Checks whether the string is equal to the character.

Returns
false if it is the case
Parameters
characterSingle character in left hand side
secondString to compare in right hand side

◆ operator!= [3/4]

NAZARA_CORE_API friend bool operator!= ( const char *  string,
const String nstring 
)
friend

Checks whether the string is equal to the "C string".

Returns
false if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator!= [4/4]

NAZARA_CORE_API friend bool operator!= ( const std::string &  string,
const String nstring 
)
friend

Checks whether the string is equal to the std::string.

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator+ [1/3]

NAZARA_CORE_API friend String operator+ ( char  character,
const String string 
)
friend

Concatenates the character to the string.

Returns
String which is the result of the concatenation
Parameters
characterSingle character
stringString in the right hand side

◆ operator+ [2/3]

NAZARA_CORE_API friend String operator+ ( const char *  string,
const String nstring 
)
friend

Concatenates the "C string" to the string.

Returns
String which is the result of the concatenation
Parameters
stringString to add
stringString in the right hand side

◆ operator+ [3/3]

NAZARA_CORE_API friend String operator+ ( const std::string &  string,
const String nstring 
)
friend

Concatenates the std::string to the string.

Returns
String which is the result of the concatenation
Parameters
stringString to add
stringString in the right hand side

◆ operator< [1/4]

NAZARA_CORE_API friend bool operator< ( const String first,
const String second 
)
friend

Checks whether the first string is less than the second string.

Returns
true if it is the case
Parameters
firstString to compare in left hand side
secondString to compare in right hand side

◆ operator< [2/4]

NAZARA_CORE_API friend bool operator< ( char  character,
const String nstring 
)
friend

Checks whether the string is less than the character.

Returns
true if it is the case
Parameters
characterSingle character in left hand side
secondString to compare in right hand side

◆ operator< [3/4]

NAZARA_CORE_API friend bool operator< ( const char *  string,
const String nstring 
)
friend

Checks whether the string is less than the "C string".

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator< [4/4]

NAZARA_CORE_API friend bool operator< ( const std::string &  string,
const String nstring 
)
friend

Checks whether the string is less than the std::string.

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator<<

NAZARA_CORE_API friend std::ostream& operator<< ( std::ostream &  out,
const String string 
)
friend

Output operator.

Returns
The stream
Parameters
outThe stream
strThe string to output

◆ operator<= [1/4]

NAZARA_CORE_API friend bool operator<= ( const String first,
const String second 
)
friend

Checks whether the first string is less or equal than the second string.

Returns
true if it is the case
Parameters
firstString to compare in left hand side
secondString to compare in right hand side

◆ operator<= [2/4]

NAZARA_CORE_API friend bool operator<= ( char  character,
const String nstring 
)
friend

Checks whether the string is less or equal than the character.

Returns
true if it is the case
Parameters
characterSingle character in left hand side
secondString to compare in right hand side

◆ operator<= [3/4]

NAZARA_CORE_API friend bool operator<= ( const char *  string,
const String nstring 
)
friend

Checks whether the string is less or equal than the "C string".

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator<= [4/4]

NAZARA_CORE_API friend bool operator<= ( const std::string &  string,
const String nstring 
)
friend

Checks whether the string is less or equal than the std::string.

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator== [1/4]

NAZARA_CORE_API friend bool operator== ( const String first,
const String second 
)
friend

Checks whether the first string is equal to the second string.

Returns
true if it is the case
Parameters
firstString to compare in left hand side
secondString to compare in right hand side

◆ operator== [2/4]

NAZARA_CORE_API friend bool operator== ( char  character,
const String nstring 
)
friend

Checks whether the string is equal to the character.

Returns
true if it is the case
Parameters
characterSingle character in left hand side
secondString to compare in right hand side

◆ operator== [3/4]

NAZARA_CORE_API friend bool operator== ( const char *  string,
const String nstring 
)
friend

Checks whether the string is equal to the "C string".

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator== [4/4]

NAZARA_CORE_API friend bool operator== ( const std::string &  string,
const String nstring 
)
friend

Checks whether the string is equal to the std::string.

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator> [1/4]

NAZARA_CORE_API friend bool operator> ( const String first,
const String second 
)
friend

Checks whether the first string is greather than the second string.

Returns
true if it is the case
Parameters
firstString to compare in left hand side
secondString to compare in right hand side

◆ operator> [2/4]

NAZARA_CORE_API friend bool operator> ( char  character,
const String nstring 
)
friend

Checks whether the string is greather than the character.

Returns
true if it is the case
Parameters
characterSingle character in left hand side
secondString to compare in right hand side

◆ operator> [3/4]

NAZARA_CORE_API friend bool operator> ( const char *  string,
const String nstring 
)
friend

Checks whether the string is greather than the "C string".

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator> [4/4]

NAZARA_CORE_API friend bool operator> ( const std::string &  string,
const String nstring 
)
friend

Checks whether the string is greather than the std::string.

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator>= [1/4]

NAZARA_CORE_API friend bool operator>= ( const String first,
const String second 
)
friend

Checks whether the first string is greather or equal than the second string.

Returns
true if it is the case
Parameters
firstString to compare in left hand side
secondString to compare in right hand side

◆ operator>= [2/4]

NAZARA_CORE_API friend bool operator>= ( char  character,
const String nstring 
)
friend

Checks whether the string is greather or equal than the character.

Returns
true if it is the case
Parameters
characterSingle character in left hand side
secondString to compare in right hand side

◆ operator>= [3/4]

NAZARA_CORE_API friend bool operator>= ( const char *  string,
const String nstring 
)
friend

Checks whether the string is greather or equal than the "C string".

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator>= [4/4]

NAZARA_CORE_API friend bool operator>= ( const std::string &  string,
const String nstring 
)
friend

Checks whether the string is greather or equal than the std::string.

Returns
true if it is the case
Parameters
stringString to compare in left hand side
secondString to compare in right hand side

◆ operator>>

NAZARA_CORE_API friend std::istream& operator>> ( std::istream &  in,
String string 
)
friend

Inputs the stream into the string.

Returns
A reference to the stream
Parameters
isStream to get information from
strString to set value

The documentation for this class was generated from the following files: