Basic string class. This class wraps the std::string to have better string access. More...
#include <spInputOutputString.hpp>
Public Member Functions | |
string () | |
string (const string< T > &Str) | |
string (const std::basic_string< T > &Str) | |
string (const std::stringstream &Str) | |
template<typename B > | |
string (const B Value) | |
~string () | |
string< T > & | operator= (const string< T > &Str) |
bool | operator== (const string< T > &Str) const |
bool | operator!= (const string< T > &Str) const |
string< T > | operator+ (const string< T > &Str) const |
string< T > & | operator+= (const string< T > &Str) |
T & | operator[] (u32 Index) |
const T & | operator[] (u32 Index) const |
std::basic_string< T > & | str () |
Returns a reference to the internal std::string object. | |
const std::basic_string< T > & | str () const |
Returns the internal std::string object. | |
const T * | c_str () const |
Returns the null terminated ANSI C string. | |
u32 | size () const |
Returns the string length. This is a synonym for the "length" function. | |
u32 | length () const |
Returns the string length. | |
void | resize (u32 Size) |
void | clear () |
bool | empty () const |
template<typename B > | |
B | val () const |
string< T > | left (u32 Len) const |
string< T > | right (u32 Len) const |
string< T > | mid (u32 Pos, u32 Len) const |
string< T > | section (u32 Pos1, u32 Pos2) const |
string< T > | trim () const |
Returns this string without any blanks or tabulators. | |
string< T > | ltrim () const |
Trims only the left side. | |
string< T > | rtrim () const |
Trims only the right side. | |
bool | leftEqual (const string< T > &Str, u32 Len) const |
Returns true if the first 'Len' characters of this string and the given string are equal. | |
bool | rightEqual (const string< T > &Str, u32 Len) const |
Returns true if the last 'Len' characters of this string and the given string are equal. | |
u32 | getLeftEquality (const string< T > &Str) const |
Returns the count of the first equal characters between this string and the given string. | |
u32 | getRightEquality (const string< T > &Str) const |
Returns the count of the last equal characters between this string and the given string. | |
s32 | find (const string< T > &Str, u32 PosBegin=0) const |
s32 | rfind (const string< T > &Str, u32 PosBegin=-1) const |
s32 | findChar (const T &SearchChar, u32 PosBegin=0) const |
s32 | rfindChar (const T &SearchChar, u32 PosBegin=-1) const |
s32 | findNot (const string< T > &Str, u32 PosBegin=0) const |
s32 | findNotSpaces (u32 PosBegin=0) const |
string< T > & | makeUpper () |
Changes this string to upper case. | |
string< T > & | makeLower () |
Changes this string to lower case. | |
string< T > | upper () const |
Returns the string with upper case only. | |
string< T > | lower () const |
Returns the string with lower case only. | |
string< T > | replace (const string< T > &StrFind, const string< T > &StrReplace, u32 PosBegin=0) const |
string< T > | getPathPart () const |
Returns the path part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "C:/Users/Lukas/Documents/"). | |
string< T > | getExtensionPart () const |
Returns the extension part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "txt"). | |
string< T > | getFilePart () const |
Returns the file part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "Test.txt"). | |
string< T > | getStrictFilePart () const |
string< T > | getRelativePath (string< T > RootPath) const |
void | adjustPath () |
string< c8 > | toAscii () const |
string< c16 > | toUnicode () const |
Static Public Member Functions | |
static T | getUpperChar (T AscChar) |
static T | getLowerChar (T AscChar) |
static string< T > | ascii (u8 Character) |
static string< T > | space (u32 Count, c8 Ascii= ' ') |
static string< T > | create (const string< T > &Str, u32 Count=1) |
static string< T > | number (u32 Number, u32 DigitsCount, const c8 Ascii= '0') |
static string< T > | numberFloat (f32 Number, u32 DecimalPlaces, bool isFillBlanks=false) |
static string< T > | numberSeperators (const string< T > &Str, const c8 Sep= ',') |
Basic string class. This class wraps the std::string to have better string access.
sp::io::string< T >::string | ( | ) | [inline] |
sp::io::string< T >::string | ( | const string< T > & | Str | ) | [inline] |
sp::io::string< T >::string | ( | const std::basic_string< T > & | Str | ) | [inline] |
sp::io::string< T >::string | ( | const std::stringstream & | Str | ) | [inline] |
sp::io::string< T >::~string | ( | ) | [inline] |
void sp::io::string< T >::adjustPath | ( | ) | [inline] |
Removes each redundant "./" strings out of the path string but keeps each "../". The string needs to be a valid path (or rather directory name) or filename.
static string<T> sp::io::string< T >::ascii | ( | u8 | Character | ) | [inline, static] |
const T* sp::io::string< T >::c_str | ( | ) | const [inline] |
Returns the null terminated ANSI C string.
void sp::io::string< T >::clear | ( | ) | [inline] |
static string<T> sp::io::string< T >::create | ( | const string< T > & | Str, | |
u32 | Count = 1 | |||
) | [inline, static] |
bool sp::io::string< T >::empty | ( | ) | const [inline] |
s32 sp::io::string< T >::find | ( | const string< T > & | Str, | |
u32 | PosBegin = 0 | |||
) | const [inline] |
Returns the position in the string (beginngin with 0) where the searched string has been found. If the string could not be found the return value is -1.
Str,: | Searched string. | |
PosBegin,: | Position where the search shall begin. |
s32 sp::io::string< T >::findChar | ( | const T & | SearchChar, | |
u32 | PosBegin = 0 | |||
) | const [inline] |
s32 sp::io::string< T >::findNot | ( | const string< T > & | Str, | |
u32 | PosBegin = 0 | |||
) | const [inline] |
Returns the position in the string (beginning with 0) where any other charaters has been found which are not named in the given string.
Str,: | String with all characters which are not wanted. | |
PosBegin,: | Position where the search shall begin. |
s32 sp::io::string< T >::findNotSpaces | ( | u32 | PosBegin = 0 |
) | const [inline] |
Similiar to the "findNot" function but this one accepts each character besides spaces (' ' and '').
PosBegin,: | Position where the search shall begin. |
string<T> sp::io::string< T >::getExtensionPart | ( | ) | const [inline] |
Returns the extension part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "txt").
string<T> sp::io::string< T >::getFilePart | ( | ) | const [inline] |
Returns the file part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "Test.txt").
u32 sp::io::string< T >::getLeftEquality | ( | const string< T > & | Str | ) | const [inline] |
Returns the count of the first equal characters between this string and the given string.
static T sp::io::string< T >::getLowerChar | ( | T | AscChar | ) | [inline, static] |
string<T> sp::io::string< T >::getPathPart | ( | ) | const [inline] |
Returns the path part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "C:/Users/Lukas/Documents/").
string<T> sp::io::string< T >::getRelativePath | ( | string< T > | RootPath | ) | const [inline] |
Returns this string as a relative path in dependency to the given root path.
io::stringc AbsolutePath = "C:/Users/TestUser/Documents/TestFile.txt"; // 'RelativePath' will contain "../Documents/TestFile.txt". io::stringc RelativePath = AbsolutePath.getRelativePath("C:/Users/TestUser/TestFolder/");
u32 sp::io::string< T >::getRightEquality | ( | const string< T > & | Str | ) | const [inline] |
Returns the count of the last equal characters between this string and the given string.
string<T> sp::io::string< T >::getStrictFilePart | ( | ) | const [inline] |
static T sp::io::string< T >::getUpperChar | ( | T | AscChar | ) | [inline, static] |
string<T> sp::io::string< T >::left | ( | u32 | Len | ) | const [inline] |
bool sp::io::string< T >::leftEqual | ( | const string< T > & | Str, | |
u32 | Len | |||
) | const [inline] |
Returns true if the first 'Len' characters of this string and the given string are equal.
u32 sp::io::string< T >::length | ( | ) | const [inline] |
Returns the string length.
string<T> sp::io::string< T >::lower | ( | ) | const [inline] |
Returns the string with lower case only.
string<T> sp::io::string< T >::ltrim | ( | ) | const [inline] |
Trims only the left side.
string<T>& sp::io::string< T >::makeLower | ( | ) | [inline] |
Changes this string to lower case.
string<T>& sp::io::string< T >::makeUpper | ( | ) | [inline] |
Changes this string to upper case.
string<T> sp::io::string< T >::mid | ( | u32 | Pos, | |
u32 | Len | |||
) | const [inline] |
static string<T> sp::io::string< T >::number | ( | u32 | Number, | |
u32 | DigitsCount, | |||
const c8 | Ascii = '0' | |||
) | [inline, static] |
Creates a string out of the given number.
io::stringc::number( 5, 3); // This returns "005" io::stringc::number(16, 3); // This returns "016"
static string<T> sp::io::string< T >::numberFloat | ( | f32 | Number, | |
u32 | DecimalPlaces, | |||
bool | isFillBlanks = false | |||
) | [inline, static] |
Creates a string out of the given floating point number.
[in] | Number | Specifies the floating point number which is to be converted to a string. |
[in] | DecimalPlaces | Specifies the number of digits after the dot. |
[in] | isFillBlanks | Specifies whether the missing digits after the dot are to be filled with nulls.
io::stringc::numberFloat(34.1678, 0); // This returns "34" io::stringc::numberFloat(34.1678, 1); // This returns "34.1" io::stringc::numberFloat(34.1678, 2); // This returns "34.16" io::stringc::numberFloat(34.16, 4, true); // This returns "34.1600" |
static string<T> sp::io::string< T >::numberSeperators | ( | const string< T > & | Str, | |
const c8 | Sep = ',' | |||
) | [inline, static] |
Converts the given string (which should only contain numbers) into a string with decimal place seperators.
[in] | Str | Specifies the string which is to be modified. |
[in] | Sep | Specifies the seperator character. By defautl ','. |
io::stringc::numberSeperators("12345"); // This returns "12,345" io::stringc::numberSeperators("1234567", '.'); // This returns "1.234.567"
bool sp::io::string< T >::operator!= | ( | const string< T > & | Str | ) | const [inline] |
string<T> sp::io::string< T >::operator+ | ( | const string< T > & | Str | ) | const [inline] |
string<T>& sp::io::string< T >::operator+= | ( | const string< T > & | Str | ) | [inline] |
string<T>& sp::io::string< T >::operator= | ( | const string< T > & | Str | ) | [inline] |
bool sp::io::string< T >::operator== | ( | const string< T > & | Str | ) | const [inline] |
T& sp::io::string< T >::operator[] | ( | u32 | Index | ) | [inline] |
const T& sp::io::string< T >::operator[] | ( | u32 | Index | ) | const [inline] |
string<T> sp::io::string< T >::replace | ( | const string< T > & | StrFind, | |
const string< T > & | StrReplace, | |||
u32 | PosBegin = 0 | |||
) | const [inline] |
void sp::io::string< T >::resize | ( | u32 | Size | ) | [inline] |
s32 sp::io::string< T >::rfind | ( | const string< T > & | Str, | |
u32 | PosBegin = -1 | |||
) | const [inline] |
s32 sp::io::string< T >::rfindChar | ( | const T & | SearchChar, | |
u32 | PosBegin = -1 | |||
) | const [inline] |
string<T> sp::io::string< T >::right | ( | u32 | Len | ) | const [inline] |
bool sp::io::string< T >::rightEqual | ( | const string< T > & | Str, | |
u32 | Len | |||
) | const [inline] |
Returns true if the last 'Len' characters of this string and the given string are equal.
string<T> sp::io::string< T >::rtrim | ( | ) | const [inline] |
Trims only the right side.
string<T> sp::io::string< T >::section | ( | u32 | Pos1, | |
u32 | Pos2 | |||
) | const [inline] |
u32 sp::io::string< T >::size | ( | ) | const [inline] |
Returns the string length. This is a synonym for the "length" function.
static string<T> sp::io::string< T >::space | ( | u32 | Count, | |
c8 | Ascii = ' ' | |||
) | [inline, static] |
const std::basic_string<T>& sp::io::string< T >::str | ( | ) | const [inline] |
Returns the internal std::string object.
std::basic_string<T>& sp::io::string< T >::str | ( | ) | [inline] |
Returns a reference to the internal std::string object.
string<c8> sp::io::string< T >::toAscii | ( | ) | const [inline] |
string<c16> sp::io::string< T >::toUnicode | ( | ) | const [inline] |
string<T> sp::io::string< T >::trim | ( | ) | const [inline] |
Returns this string without any blanks or tabulators.
string<T> sp::io::string< T >::upper | ( | ) | const [inline] |
Returns the string with upper case only.