0.44.0
|
#include <iaString.h>
Public Types | |
enum class | Alignment { Left , Right , Center } |
Public Member Functions | |
iaString ()=default | |
iaString (const char *text, const int64 length=INVALID_POSITION) | |
iaString (const wchar_t *text, const int64 length=INVALID_POSITION) | |
iaString (const wchar_t character, int count=1) | |
iaString (const char character, int count=1) | |
iaString (const iaString &text) | |
~iaString () | |
int64 | getLength () const |
int64 | getSize () const |
int64 | getHashValue () const |
void | toLower () |
void | toUpper () |
iaString | operator+ (const iaString &text) const |
void | operator+= (const iaString &text) |
iaString | operator+ (const wchar_t &character) const |
void | operator+= (const wchar_t &character) |
bool | operator== (const iaString &text) const |
bool | operator== (const wchar_t *text) const |
bool | operator== (const char *text) const |
bool | operator!= (const iaString &text) const |
iaString | operator= (const iaString &text) |
iaString | operator= (const wchar_t *text) |
iaString | operator= (const char *text) |
iaString | operator= (const wchar_t character) |
iaString | operator= (const char character) |
bool | operator< (const iaString &text) const |
bool | operator> (const iaString &text) const |
wchar_t & | operator[] (const int64 index) |
const wchar_t & | operator[] (const int64 index) const |
iaString | getSubString (const int64 pos, const int64 len=INVALID_POSITION) const |
void | split (const iaString &delimiters, std::vector< iaString > &tokens, iaStringSplitMode splitMode=iaStringSplitMode::Normal) const |
void | split (const wchar_t delimiter, std::vector< iaString > &tokens, iaStringSplitMode splitMode=iaStringSplitMode::Normal) const |
void | split (const char delimiter, std::vector< iaString > &tokens, iaStringSplitMode splitMode=iaStringSplitMode::Normal) const |
int64 | findFirstOf (const iaString &characters, const int64 from=INVALID_POSITION) const |
int64 | findFirstOf (const wchar_t *characters, const int64 from=INVALID_POSITION) const |
int64 | findFirstOf (const wchar_t character, const int64 from=INVALID_POSITION) const |
int64 | findFirstNotOf (const wchar_t *characters, const int64 from=INVALID_POSITION) const |
int64 | findFirstNotOf (const wchar_t character, const int64 from=INVALID_POSITION) const |
int64 | findLastOf (const wchar_t character) const |
int64 | findLastOf (const wchar_t *characters) const |
int64 | findLastNotOf (const wchar_t character) const |
int64 | findLastNotOf (const wchar_t *characters) const |
void | clear () |
bool | isEmpty () const |
const wchar_t * | getData () const |
int64 | getData (char *buffer, const int64 size) const |
int64 | getUTF8 (char *buffer, const int64 size) const |
int64 | getUTF8Size () const |
void | setUTF8 (const char *buffer, const int64 size) |
void | reverse () |
void | insert (const iaString &text, int64 pos) |
void | remove (int64 pos, int64 length) |
Static Public Member Functions | |
static iaString | align (const iaString &text, int width, Alignment alignment, wchar_t character=L' ') |
static iaString | toString (uint64 value, int base=10) |
static iaString | toString (int64 value, int base=10) |
static iaString | toString (int32 value, int base=10) |
static iaString | toString (uint32 value, int base=10) |
static iaString | toString (float64 value, int afterPoint=4) |
static iaString | toString (float32 value, int afterPoint=4) |
static iaString | toStringUnits (int64 value) |
static float64 | toFloat (const iaString &text) |
static int64 | toInt (const iaString &text) |
static uint64 | toUInt (const iaString &text, int base=10) |
static bool | toBool (const iaString &text) |
template<class T > | |
static void | toVector (const iaString &text, iaVector2< T > &vector) |
template<class T > | |
static void | toVector (const iaString &text, iaVector3< T > &vector) |
template<class T > | |
static void | toVector (const iaString &text, iaVector4< T > &vector) |
static iaString | wildcardToRegex (const iaString &pattern) |
static iaString | trimLeft (const iaString &text) |
static iaString | trimRight (const iaString &text) |
static iaString | trim (const iaString &text) |
static bool | matchRegex (const iaString &text, const iaString ®ex) |
static void | replaceRegex (const iaString &src, const iaString ®ex, const iaString &replaceWith, iaString &dst) |
static bool | searchRegex (const iaString &src, const iaString ®ex, std::vector< iaString > &matches) |
Static Public Attributes | |
static const int64 | INVALID_POSITION = -1 |
wide char (unicode) character string with trailing zero and length
|
strong |
|
default |
default ctor does nothing
iaux::iaString::iaString | ( | const char * | text, |
const int64 | length = INVALID_POSITION |
||
) |
ctor with byte string
text | byte string |
length | if input string is not zero terminated or a custom length is needed |
iaux::iaString::iaString | ( | const wchar_t * | text, |
const int64 | length = INVALID_POSITION |
||
) |
copies unicode string
text | unicode string |
length | if input string is not zero terminated or a custom length is needed |
iaux::iaString::iaString | ( | const wchar_t | character, |
int | count = 1 |
||
) |
creates a string using given character
character | the wide character to create the string with |
count | how many times the character will be added to this string |
iaux::iaString::iaString | ( | const char | character, |
int | count = 1 |
||
) |
creates a string with only one character
character | the character to create the string with |
count | how many times the character will be added to this string |
iaux::iaString::iaString | ( | const iaString & | text | ) |
copy ctor
text | the string to copy from |
iaux::iaString::~iaString | ( | ) |
dtor releases allocated memory
|
static |
adds padding to text so target width is reached
text | the given text |
width | the target text length |
alignment | the desired alignment of the text |
character | the character used to fill up the string |
void iaux::iaString::clear | ( | ) |
empties the string
int64 iaux::iaString::findFirstNotOf | ( | const wchar_t * | characters, |
const int64 | from = INVALID_POSITION |
||
) | const |
if not found INVALID_POSITION will be returned
characters | the characters to NOT search for |
from | optional parameter to define start index to search from |
int64 iaux::iaString::findFirstNotOf | ( | const wchar_t | character, |
const int64 | from = INVALID_POSITION |
||
) | const |
if not found INVALID_POSITION will be returned
character | the character to NOT search for |
from | optional parameter to define start index to search from |
int64 iaux::iaString::findFirstOf | ( | const iaString & | characters, |
const int64 | from = INVALID_POSITION |
||
) | const |
if not found iaString::INVALID_POSITION will be returned
characters | the characters to search for |
from | optional parameter to define start index to search from |
int64 iaux::iaString::findFirstOf | ( | const wchar_t * | characters, |
const int64 | from = INVALID_POSITION |
||
) | const |
if not found iaString::INVALID_POSITION will be returned
characters | the characters to search for |
from | optional parameter to define start index to search from |
int64 iaux::iaString::findFirstOf | ( | const wchar_t | character, |
const int64 | from = INVALID_POSITION |
||
) | const |
if not found INVALID_POSITION will be returned
character | the character to search for |
from | optional parameter to define start index to search from |
int64 iaux::iaString::findLastNotOf | ( | const wchar_t * | characters | ) | const |
if not found INVALID_POSITION will be returned
characters | the characters to search for |
int64 iaux::iaString::findLastNotOf | ( | const wchar_t | character | ) | const |
if not found INVALID_POSITION will be returned
character | the character to search for |
int64 iaux::iaString::findLastOf | ( | const wchar_t * | characters | ) | const |
if not found INVALID_POSITION will be returned
characters | the characters to search for |
int64 iaux::iaString::findLastOf | ( | const wchar_t | character | ) | const |
if not found INVALID_POSITION will be returned
character | the character to search for |
const wchar_t * iaux::iaString::getData | ( | ) | const |
returns null terminated byte string
buffer | pre allocated buffer to write the string to |
size | size of preallocated buffer |
int64 iaux::iaString::getHashValue | ( | ) | const |
int64 iaux::iaString::getLength | ( | ) | const |
int64 iaux::iaString::getSize | ( | ) | const |
iaString iaux::iaString::getSubString | ( | const int64 | pos, |
const int64 | len = INVALID_POSITION |
||
) | const |
pos | substring from |
len | substring length |
returns utf8 encoded string
buffer | the destination buffer for the utf8 string |
size | the size of the destination buffer |
int64 iaux::iaString::getUTF8Size | ( | ) | const |
calculates the size in bytes of the string encoded in utf8
insert text at given position
text | the text to insert |
pos | the position where to insert the text |
bool iaux::iaString::isEmpty | ( | ) | const |
text | the given text |
regex | the given regular expression |
bool iaux::iaString::operator!= | ( | const iaString & | text | ) | const |
++ operator to compare to strings
text | the strin to compare with |
text | the string to add |
iaString iaux::iaString::operator+ | ( | const wchar_t & | character | ) | const |
character | character to add |
void iaux::iaString::operator+= | ( | const iaString & | text | ) |
+= operator concatanates strings
text | the string to add to the current string |
void iaux::iaString::operator+= | ( | const wchar_t & | character | ) |
+= operator to add a single character
character | character to add |
bool iaux::iaString::operator< | ( | const iaString & | text | ) | const |
compares two strings and returns true if the left hand side string is considered smaller
text | the right hand side string |
iaString iaux::iaString::operator= | ( | const char * | text | ) |
= operator overwrites current string with new string
text | the new string |
iaString iaux::iaString::operator= | ( | const char | character | ) |
= operator overwrites current string with one character
character | the character |
= operator overwrites current string with new string
text | the new string |
iaString iaux::iaString::operator= | ( | const wchar_t * | text | ) |
= operator overwrites current string with new string
text | the new string |
iaString iaux::iaString::operator= | ( | const wchar_t | character | ) |
= operator overwrites current string with one character
character | the character |
bool iaux::iaString::operator== | ( | const char * | text | ) | const |
== operator to compare to strings
text | the string to compare with |
bool iaux::iaString::operator== | ( | const iaString & | text | ) | const |
== operator to compare to strings
text | the string to compare with |
bool iaux::iaString::operator== | ( | const wchar_t * | text | ) | const |
== operator to compare to strings
text | the string to compare with |
bool iaux::iaString::operator> | ( | const iaString & | text | ) | const |
compares two strings and returns true if the left hand side string is considered bigger
text | the right hand side string |
wchar_t & iaux::iaString::operator[] | ( | const int64 | index | ) |
index | the position to get the character from |
const wchar_t & iaux::iaString::operator[] | ( | const int64 | index | ) | const |
index | the position to get the character from |
removed characters from string
pos | index of first character to remove |
length | amount of characters to remove |
|
static |
replace sections in source text and return destination text
[out] | dst | the destination text |
src | the source text | |
regex | the regular expression to find the patterns to replace | |
replaceWith | the text to replace the patterns with |
void iaux::iaString::reverse | ( | ) |
reverses the string
|
static |
searches for matches in string with given regular expression
src | the source string to search | |
regex | the regular expression | |
[out] | the | found matches |
void iaux::iaString::setUTF8 | ( | const char * | buffer, |
const int64 | size | ||
) |
set string with utf8 encoded string
buffer | source buffer with utf8 string |
size | the size of the source buffer |
void iaux::iaString::split | ( | const char | delimiter, |
std::vector< iaString > & | tokens, | ||
iaStringSplitMode | splitMode = iaStringSplitMode::Normal |
||
) | const |
same as split with delimiter string but only for one delimiter character
delimiter | single delimiter character |
tokens | the resulting tokens |
void iaux::iaString::split | ( | const iaString & | delimiters, |
std::vector< iaString > & | tokens, | ||
iaStringSplitMode | splitMode = iaStringSplitMode::Normal |
||
) | const |
splits a string based on delimiter in to tokens (or substrings)
delimiters | string with delimiter characters |
tokens | the resulting tokens |
void iaux::iaString::split | ( | const wchar_t | delimiter, |
std::vector< iaString > & | tokens, | ||
iaStringSplitMode | splitMode = iaStringSplitMode::Normal |
||
) | const |
same as split with delimiter string but only for one delimiter character
delimiter | single delimiter character |
tokens | the resulting tokens |
|
static |
converts string in to bool value
on error it falls back to false
text | the text to convert |
void iaux::iaString::toLower | ( | ) |
change string to lower case letters
transforms a float to a iaString
value | the float value |
afterPoint | defines how many digits after the point |
transforms a float to a iaString
value | the float value |
afterPoint | defines how many digits after the point |
transforms an integer to a iaString
value | the integer value |
base | the number base |
transforms an integer to a iaString
value | the integer value |
base | the number base |
transforms an integer to a iaString
value | the integer value |
base | the number base |
transforms an integer to a iaString
value | the integer value |
base | the number base |
human readabile number
3000 -> 3k 3000000 -> 3M 3000000000 -> 3G 3000000000000 -> 3T
value | input value |
void iaux::iaString::toUpper | ( | ) |
change string to upper case letters
|
static |
converts a string to a 2d vector
expect two comma separated values
text | the text to parse | |
[out] | vector | the resulting vector |
|
static |
converts a string to a 3d vector
expect two comma separated values
text | the text to parse | |
[out] | vector | the resulting vector |
|
static |
converts a string to a 4d vector
expect two comma separated values
text | the text to parse | |
[out] | vector | the resulting vector |
trims white spaces on both ends of the string
text | the source text |
trims white spaces on the left hand side
text | the source text |
trims white spaces on the right hand side
text | the source text |
turn wildcard expression in to regex expression
pattern | the wildcard expression |
|
static |
this defines a position that is out of range