![]() |
ezEngine
Release 25.03
|
Base class for strings, which implements all read-only string functions. More...
#include <StringBase.h>
Public Types | |
using | iterator = ezStringIterator |
using | const_iterator = ezStringIterator |
using | reverse_iterator = ezStringReverseIterator |
using | const_reverse_iterator = ezStringReverseIterator |
Public Member Functions | |
bool | IsEmpty () const |
Returns whether the string is an empty string. | |
bool | StartsWith (ezStringView sStartsWith) const |
Returns true, if this string starts with the given string. | |
bool | StartsWith_NoCase (ezStringView sStartsWith) const |
Returns true, if this string starts with the given string. Case insensitive. | |
bool | EndsWith (ezStringView sEndsWith) const |
Returns true, if this string ends with the given string. | |
bool | EndsWith_NoCase (ezStringView sEndsWith) const |
Returns true, if this string ends with the given string. Case insensitive. | |
const char * | FindSubString (ezStringView sStringToFind, const char *szStartSearchAt=nullptr) const |
const char * | FindSubString_NoCase (ezStringView sStringToFind, const char *szStartSearchAt=nullptr) const |
const char * | FindLastSubString (ezStringView sStringToFind, const char *szStartSearchAt=nullptr) const |
const char * | FindLastSubString_NoCase (ezStringView sStringToFind, const char *szStartSearchAt=nullptr) const |
const char * | FindWholeWord (const char *szSearchFor, ezStringUtils::EZ_CHARACTER_FILTER isDelimiterCB, const char *szStartSearchAt=nullptr) const |
const char * | FindWholeWord_NoCase (const char *szSearchFor, ezStringUtils::EZ_CHARACTER_FILTER isDelimiterCB, const char *szStartSearchAt=nullptr) const |
ezInt32 | Compare (ezStringView sOther) const |
Compares this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise. | |
ezInt32 | CompareN (ezStringView sOther, ezUInt32 uiCharsToCompare) const |
ezInt32 | Compare_NoCase (ezStringView sOther) const |
Compares this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise. Case insensitive. | |
ezInt32 | CompareN_NoCase (ezStringView sOther, ezUInt32 uiCharsToCompare) const |
bool | IsEqual (ezStringView sOther) const |
Compares this string with the other string for equality. | |
bool | IsEqualN (ezStringView sOther, ezUInt32 uiCharsToCompare) const |
Compares up to a given number of characters of this string with the other string for equality. Case insensitive. | |
bool | IsEqual_NoCase (ezStringView sOther) const |
Compares this string with the other string for equality. | |
bool | IsEqualN_NoCase (ezStringView sOther, ezUInt32 uiCharsToCompare) const |
Compares up to a given number of characters of this string with the other string for equality. Case insensitive. | |
const char * | ComputeCharacterPosition (ezUInt32 uiCharacterIndex) const |
Computes the pointer to the n-th character in the string. This is a linear search from the start. | |
iterator | GetIteratorFront () const |
Returns an iterator to this string, which points to the very first character. More... | |
reverse_iterator | GetIteratorBack () const |
Returns an iterator to this string, which points to the very last character (NOT the end). More... | |
operator ezStringView () const | |
Returns a string view to this string's data. | |
ezStringView | GetView () const |
Returns a string view to this string's data. | |
EZ_ALWAYS_INLINE | operator const char * () const |
Returns a pointer to the internal Utf8 string. | |
template<typename Container > | |
void | Split (bool bReturnEmptyStrings, Container &ref_output, const char *szSeparator1, const char *szSeparator2=nullptr, const char *szSeparator3=nullptr, const char *szSeparator4=nullptr, const char *szSeparator5=nullptr, const char *szSeparator6=nullptr) const |
Fills the given container with ezStringView's which represent each found substring. If bReturnEmptyStrings is true, even empty strings between separators are returned. Output must be a container that stores ezStringView's and provides the functions 'Clear' and 'Append'. szSeparator1 to szSeparator6 are strings which act as separators and indicate where to split the string. This string itself will not be modified. | |
bool | HasAnyExtension () const |
Checks whether the given path has any file extension. | |
bool | HasExtension (ezStringView sExtension) const |
Checks whether the given path ends with the given extension. szExtension should start with a '.' for performance reasons, but it will work without a '.' too. | |
ezStringView | GetFileExtension (bool bFullExtension=false) const |
Returns the file extension of the given path. Will be empty, if the path does not end with a proper extension. | |
ezStringView | GetFileName () const |
Returns the file name of a path, excluding the path and extension. More... | |
ezStringView | GetFileNameAndExtension () const |
Returns the substring that represents the file name including the file extension. More... | |
ezStringView | GetFileDirectory () const |
Returns the directory of the given file, which is the substring up to the last path separator. More... | |
bool | IsAbsolutePath () const |
Returns true, if the given path represents an absolute path on the current OS. | |
bool | IsRelativePath () const |
Returns true, if the given path represents a relative path on the current OS. | |
bool | IsRootedPath () const |
Returns true, if the given path represents a 'rooted' path. See ezFileSystem for details. | |
ezStringView | GetRootedPathRootName () const |
Extracts the root name from a rooted path. More... | |
Friends | |
template<typename Derived2 > | |
ezStringBase< Derived2 >::iterator | begin (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::const_iterator | cbegin (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::iterator | end (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::const_iterator | cend (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::reverse_iterator | rbegin (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::const_reverse_iterator | crbegin (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::reverse_iterator | rend (const ezStringBase< Derived2 > &container) |
template<typename Derived2 > | |
ezStringBase< Derived2 >::const_reverse_iterator | crend (const ezStringBase< Derived2 > &container) |
Base class for strings, which implements all read-only string functions.
ezInt32 ezStringBase< Derived >::CompareN | ( | ezStringView | sOther, |
ezUInt32 | uiCharsToCompare | ||
) | const |
Compares up to a given number of characters of this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise.
ezInt32 ezStringBase< Derived >::CompareN_NoCase | ( | ezStringView | sOther, |
ezUInt32 | uiCharsToCompare | ||
) | const |
Compares up to a given number of characters of this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise. Case insensitive.
|
inline |
Returns a pointer to the last occurrence of szStringToFind, or nullptr if none was found. szStartSearchAt allows to start searching at the end of the string (if it is nullptr) or at an earlier position.
|
inline |
Returns a pointer to the last occurrence of szStringToFind, or nullptr if none was found. Case insensitive. szStartSearchAt allows to start searching at the end of the string (if it is nullptr) or at an earlier position.
const char * ezStringBase< Derived >::FindSubString | ( | ezStringView | sStringToFind, |
const char * | szStartSearchAt = nullptr |
||
) | const |
Returns a pointer to the first occurrence of szStringToFind, or nullptr if none was found. To find the next occurrence, use an ezStringView which points to the next position and call FindSubString again.
const char * ezStringBase< Derived >::FindSubString_NoCase | ( | ezStringView | sStringToFind, |
const char * | szStartSearchAt = nullptr |
||
) | const |
Returns a pointer to the first occurrence of szStringToFind, or nullptr if none was found. Case insensitive. To find the next occurrence, use an ezStringView which points to the next position and call FindSubString again.
|
inline |
Searches for the word szSearchFor. If IsDelimiterCB returns true for both characters in front and back of the word, the position is returned. Otherwise nullptr.
|
inline |
Searches for the word szSearchFor. If IsDelimiterCB returns true for both characters in front and back of the word, the position is returned. Otherwise nullptr. Ignores case.
ezStringView ezStringBase< Derived >::GetFileDirectory |
Returns the directory of the given file, which is the substring up to the last path separator.
If the path already ends in a path separator, and thus points to a folder, instead of a file, the unchanged path is returned. "path/to/file" -> "path/to/" "path/to/folder/" -> "path/to/folder/" "filename" -> "" "/file_at_root_level" -> "/"
ezStringView ezStringBase< Derived >::GetFileName |
Returns the file name of a path, excluding the path and extension.
If the path already ends with a path separator, the result will be empty.
ezStringView ezStringBase< Derived >::GetFileNameAndExtension |
Returns the substring that represents the file name including the file extension.
Returns an empty string, if sPath already ends in a path separator, or is empty itself.
ezStringBase< Derived >::reverse_iterator ezStringBase< Derived >::GetIteratorBack |
Returns an iterator to this string, which points to the very last character (NOT the end).
Note that this iterator will only be valid as long as this string lives. Once the original string is destroyed, all iterators to them will point into invalid memory.
ezStringBase< Derived >::iterator ezStringBase< Derived >::GetIteratorFront |
Returns an iterator to this string, which points to the very first character.
Note that this iterator will only be valid as long as this string lives. Once the original string is destroyed, all iterators to them will point into invalid memory.
ezStringView ezStringBase< Derived >::GetRootedPathRootName |
Extracts the root name from a rooted path.
":MyRoot" -> "MyRoot" ":MyRoot\folder" -> "MyRoot" ":\MyRoot\folder" -> "MyRoot" ":/MyRoot\folder" -> "MyRoot" Returns an empty string, if the path is not rooted.