template class Core::CStringTraits
Overview
C-String traits class, safe for ASCII-encoded text only! More…
#include <corestringtraits.h> template <typename T> class CStringTraits { public: // methods CStringPtr str() const; bool isEmpty() const; int length() const; bool copyTo(char* charBuffer, int bufferSize) const; int index(CStringPtr other) const; bool contains(CStringPtr other) const; bool startsWith(CStringPtr other) const; bool endsWith(CStringPtr other) const; int index(char c) const; int index(uchar c) const; int lastIndex(char c) const; int lastIndex(uchar c) const; bool contains(char c) const; int compare(CStringPtr other, bool caseSensitive = true) const; bool getIntValue(int32& value) const; bool getIntValue(int64& value) const; int scanInt(int fallback = 0) const; int64 scanLargetInt(int64 fallback = 0) const; bool getHexValue(int64& value) const; bool getFloatValue(double& value) const; bool getFloatValue(float& value) const; float scanFloat(float fallback = 0) const; double scanDouble(double fallback = 0) const; unsigned int getHashCode() const; bool operator == (CStringPtr other) const; bool operator != (CStringPtr other) const; template <class S> bool operator == (const CStringTraits<S>& other) const; template <class S> bool operator != (const CStringTraits<S>& other) const; bool equalsUnsafe(CStringPtr other) const; char at(int index) const; char firstChar() const; char lastChar() const; char operator [] (int index) const; operator CStringPtr () const; }; // direct descendants class ConstString; template <int maxSize> class CStringBuffer;
Detailed Documentation
C-String traits class, safe for ASCII-encoded text only!
Methods
CStringPtr str() const
Get plain C-String.
bool isEmpty() const
Check if string is empty.
int length() const
Get string length.
bool copyTo(char* charBuffer, int bufferSize) const
Copy to buffer.
int index(CStringPtr other) const
Get position of other C-String.
bool contains(CStringPtr other) const
Check if this contains other C-String.
bool startsWith(CStringPtr other) const
Check if this starts with other C-String.
bool endsWith(CStringPtr other) const
Check if this ends with other C-String.
int index(char c) const
Get first position of ASCII character.
int index(uchar c) const
Get first position of Unicode character.
int lastIndex(char c) const
Get last position of ASCII character.
int lastIndex(uchar c) const
Get last position of Unicode character.
bool contains(char c) const
Check if this contains other ASCII character.
int compare(CStringPtr other, bool caseSensitive = true) const
Compare with other C-String.
bool getIntValue(int32& value) const
Get integer from string.
bool getIntValue(int64& value) const
Get integer from string.
bool getHexValue(int64& value) const
Get hexadecimal integer from string.
bool getFloatValue(double& value) const
Get double from string.
bool getFloatValue(float& value) const
Get float from string.
unsigned int getHashCode() const
Hash string to integer value.
bool operator == (CStringPtr other) const
Compare with other C-String.
bool operator != (CStringPtr other) const
Compare with other C-String.
template <class S> bool operator == (const CStringTraits<S>& other) const
Compare with other CStringTraits (with possibly different type S).
template <class S> bool operator != (const CStringTraits<S>& other) const
Compare with other CStringTraits (with possibly different type S).
bool equalsUnsafe(CStringPtr other) const
Compare with other C-String.
Does not check if other is null.
char at(int index) const
Get the character at the specified index.
char firstChar() const
Get the first character in the string.
char lastChar() const
Get the last character in the string.
char operator [] (int index) const
Get the character at the specified index.
operator CStringPtr () const
Cast to plain C-String.