nux-1.14.0
|
Public Member Functions | |
NString (const NString &s) | |
NString (const tstring &s) | |
NString (const TCHAR &s) | |
NString (const ANSICHAR *s) | |
NString (const UNICHAR *s) | |
NString & | operator= (const NString &s) |
const tstring & | GetTStringRef () const |
const TCHAR * | GetTCharPtr () const |
t_size | Length () const |
t_size | Size () const |
void | Clear () |
bool | IsEmpty () const |
void | Erase (t_size Pos, t_size count) |
NString & | Insert (t_size Pos, const TCHAR *Ptr) |
NString & | Insert (t_size Pos, const TCHAR *Ptr, t_size Count) |
NString & | Insert (t_size Pos, const tstring &Str) |
NString & | Insert (t_size Pos, const tstring &Str, t_size Offset, t_size Count) |
NString & | Insert (t_size Pos, const NString &Str) |
NString & | Insert (t_size Pos, const NString &Str, t_size Offset, t_size Count) |
NString & | Insert (t_size Pos, int Count, const TCHAR &Ch) |
const TCHAR & | operator[] (t_size ChPos) const |
TCHAR & | operator[] (t_size ChPos) |
NString & | Replace (t_size Pos1, t_size Num1, const TCHAR *Ptr) |
NString & | Replace (t_size Pos1, t_size Num1, const TCHAR *Ptr, t_size Num2) |
NString & | Replace (t_size Pos1, t_size Num1, const tstring &Str) |
NString & | Replace (t_size Pos1, t_size Num1, const tstring &Str, t_size Pos2, t_size Num2) |
NString & | Replace (t_size Pos1, t_size Num1, const NString &Str) |
NString & | Replace (t_size Pos1, t_size Num1, const NString &Str, t_size Pos2, t_size Num2) |
NString & | Replace (t_size Pos1, t_size Num1, t_size Count, TCHAR Ch) |
void | Reverse () |
Reverse the string. | |
NString & | SearchAndReplace (TCHAR ChOut, TCHAR ChIn) |
Replace character ChOut with ChIn in the string. | |
t_size | FindLastOccurence (const TCHAR &suffix) const |
Return The last position of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurence (const TCHAR *suffix) const |
Return The last position of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurence (const tstring &suffix) const |
Return The last position of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurence (const NString &suffix) const |
Return The last position of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurence (const TCHAR &suffix) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurence (const TCHAR *suffix) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurence (const tstring &suffix) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurence (const NString &suffix) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindNextOccurence (const TCHAR &suffix, t_size start=0) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindNextOccurence (const TCHAR *suffix, t_size start=0) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindNextOccurence (const tstring &suffix, t_size start=0) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindNextOccurence (const NString &suffix, t_size start=0) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurenceOf (const TCHAR &str) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurenceOf (const TCHAR *str) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurenceOf (const tstring &str) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindFirstOccurenceOf (const NString &str) const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurenceOf (const TCHAR &str) const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurenceOf (const TCHAR *str) const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurenceOf (const tstring &str) const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found. | |
t_size | FindLastOccurenceOf (const NString &str) const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found. | |
t_size | Find (NString str, int start=0) |
Searches this string for the first match of a substring. | |
t_size | Find (TCHAR c, int start=0) |
Searches this string for the first match of a character. | |
bool | IsSuffix (const TCHAR &suffix) |
Return True if the string is terminated by the character 'suffix'. | |
bool | IsSuffix (const TCHAR *suffix) |
Return True if the string is terminated by the character string 'suffix'. | |
bool | IsSuffix (const tstring &suffix) |
Return True if the string is terminated by the tstring 'suffix'. | |
bool | IsSuffix (const NString &suffix) |
Return True if the string is terminated by the NString 'suffix'. | |
bool | IsPrefix (const TCHAR &prefix) |
Return True if the string start with the character contained in prefix. | |
bool | IsPrefix (const TCHAR *prefix) |
Return True if the string start with the character string contained in prefix. | |
bool | IsPrefix (const tstring &prefix) |
Return True if the string start with the tstring contained in prefix. | |
bool | IsPrefix (const NString &prefix) |
Return True if the string start with the NString contained in prefix. | |
void | RemoveSuffix (const TCHAR &suffix) |
Remove the suffix if it is present. | |
void | RemoveSuffix (const TCHAR *suffix) |
Remove the suffix if it is present. | |
void | RemoveSuffix (const tstring &suffix) |
Remove the suffix if it is present. | |
void | RemoveSuffix (const NString &suffix) |
Remove the suffix if it is present. | |
void | RemovePrefix (const TCHAR &prefix) |
Remove the prefix if it is present. | |
void | RemovePrefix (const TCHAR *prefix) |
Remove the prefix if it is present. | |
void | RemovePrefix (const tstring &prefix) |
Remove the prefix if it is present. | |
void | RemovePrefix (const NString &prefix) |
Remove the prefix if it is present. | |
NString | GetSubString (t_size count) const |
Return an NString of the first count characters. | |
NString | GetSubString (t_size start, t_size count) const |
Return an NString of the first count characters starting at position start. | |
NString | Mid (t_size count) const |
Extracts the first N characters.. | |
NString | Mid (t_size start, t_size count) const |
Extracts the middle part of a string. | |
NString | Left (t_size N) const |
Extracts the left part of a string. At most N characters are extracted. | |
NString | Right (t_size N) const |
Extracts the right part of a string. At most N characters are extracted. | |
NString | Trim () const |
Trims all leading and trailing whitespace characters from the string. | |
NString | TrimLeft () const |
Trim the white space characters at the start of this string. Return a trimmed NString. | |
NString | TrimRight () const |
Trim the white space characters at the end of this string. Return a trimmed NString. | |
NString | TrimLeft (NString str) const |
Trim any of the characters in the argument string. Return a trimmed NString. | |
NString | TrimRight (NString str) const |
Trim any of the characters in the argument string. Return a trimmed NString. | |
TCHAR | GetFirstChar () const |
Get first character. | |
TCHAR | GetLastChar () const |
Get last character. | |
const TCHAR * | operator() () const |
const TCHAR * | operator* () const |
NString & | operator+= (const TCHAR &sufix) |
Append a character to this string. | |
NString & | operator+= (const TCHAR *sufix) |
Append a TCHAR* to this string. | |
NString & | operator+= (const tstring sufix) |
Append a tstring to this string. | |
NString & | operator+= (const NString sufix) |
Append an NString to this string. | |
void | SplitAtFirstOccurenceOf (const TCHAR *SplitString, NString &Left, NString &Right) |
void | SplitAtFirstOccurenceOf (const TCHAR &SplitChar, NString &Left, NString &Right) |
void | SplitAtFirstOccurenceOf (const NString &SplitString, NString &Left, NString &Right) |
void | SplitAtLastOccurenceOf (const TCHAR *SplitString, NString &Left, NString &Right) |
void | SplitAtLastOccurenceOf (const TCHAR &SplitChar, NString &Left, NString &Right) |
void | SplitAtLastOccurenceOf (const NString &SplitString, NString &Left, NString &Right) |
void | ParseToArray (std::vector< NString > &StringArray, const NString &delimiter) |
VARARG_DECL (static NString, static NString, return, Printf, VARARG_NONE, const TCHAR *, VARARG_NONE, VARARG_NONE) | |
Public Attributes | |
tstring | m_string |
Friends | |
bool | operator!= (const NString &left, const NString &right) |
bool | operator== (const NString &left, const NString &right) |
bool | operator< (const NString &left, const NString &right) |
bool | operator<= (const NString &left, const NString &right) |
bool | operator> (const NString &left, const NString &right) |
bool | operator>= (const NString &left, const NString &right) |
NString | operator+ (const NString &left, const NString &right) |
NString | operator+ (const NString &left, const TCHAR *right) |
NString | operator+ (const NString &left, const TCHAR right) |
NString | operator+ (const TCHAR *left, const NString &right) |
NString | operator+ (const TCHAR left, const NString &right) |
tostream & | operator<< (tostream &o, const NString &s) |
Definition at line 650 of file TextString.h.
t_size nux::NString::FindFirstOccurenceOf | ( | const TCHAR & | str | ) | const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the first character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 702 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_first_of (str, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindFirstOccurenceOf | ( | const tstring & | str | ) | const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the first character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 716 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_first_of (str, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindFirstOccurenceOf | ( | const NString & | str | ) | const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the first character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 723 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_first_of (str.m_string, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindFirstOccurenceOf | ( | const TCHAR * | str | ) | const |
Return the position of the first occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the first character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 709 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_first_of (str, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindLastOccurenceOf | ( | const TCHAR & | str | ) | const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the last character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 731 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_last_of (str, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindLastOccurenceOf | ( | const tstring & | str | ) | const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the last character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 745 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_last_of (str, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindLastOccurenceOf | ( | const TCHAR * | str | ) | const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the last character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 738 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_last_of (str, pos);
return (pos != tstring::npos) ? pos : -1;
}
t_size nux::NString::FindLastOccurenceOf | ( | const NString & | str | ) | const |
Return the position of the last occurrence of the substring suffix or -1 if it is not found.
Searches through a string for the last character that matches any element of a specified string. Return -1 if it is not found.
Definition at line 752 of file TextString.cpp.
{
t_size pos = 0;
pos = m_string.find_last_of (str.m_string, pos);
return (pos != tstring::npos) ? pos : -1;
}
TCHAR nux::NString::GetFirstChar | ( | ) | const |
Get first character.
Definition at line 1272 of file TextString.cpp.
Referenced by nux::NFileName::AddBackSlashAtStart(), and nux::NFileName::AddSlashAtStart().
{ if (IsEmpty() ) return 0; return m_string[0]; }
TCHAR nux::NString::GetLastChar | ( | ) | const |
Get last character.
Definition at line 1279 of file TextString.cpp.
Referenced by nux::NFileName::AddBackSlashAtEnd(), and nux::NFileName::AddSlashAtEnd().
{ if (IsEmpty() ) return 0; return m_string[Size()-1]; }
bool nux::NString::IsSuffix | ( | const tstring & | suffix | ) |
Return True if the string is terminated by the tstring 'suffix'.
Return True is the the string is terminated by the tstring 'suffix'.
Definition at line 807 of file TextString.cpp.
References FindLastOccurence().
{ t_size sl = suffix.length(); if (sl == 0) return false; t_size l = m_string.length() - sl; if (l < 0) return false; t_size pos = FindLastOccurence (suffix); if (pos == tstring::npos) return false; return (pos == l); }
bool nux::NString::IsSuffix | ( | const NString & | suffix | ) |
Return True if the string is terminated by the NString 'suffix'.
Return True is the the string is terminated by the NString 'suffix'.
Definition at line 828 of file TextString.cpp.
References FindLastOccurence().
{ t_size sl = suffix.Length(); if (sl == 0) return false; t_size l = m_string.length() - sl; if (l < 0) return false; t_size pos = FindLastOccurence (suffix); if (pos == tstring::npos) return false; return (pos == l); }
void nux::NString::RemovePrefix | ( | const TCHAR & | prefix | ) |
Remove the prefix if it is present.
Return an NString striped out of the prefix contained in prefix.
Definition at line 952 of file TextString.cpp.
References IsPrefix().
Referenced by nux::EditTextBox::GetCleanText(), nux::NFileName::RemoveBackSlashAtStart(), and nux::NFileName::RemoveSlashAtStart().
{ if (IsPrefix (prefix) ) { *this = NString (m_string.substr (1) ); } }
void nux::NString::RemovePrefix | ( | const NString & | prefix | ) |
Remove the prefix if it is present.
Return an NString striped out of the prefix contained in prefix.
Definition at line 981 of file TextString.cpp.
References IsPrefix().
{ if (IsPrefix (prefix) ) { t_size l = prefix.Length(); *this = NString (m_string.substr (l) ); } }
void nux::NString::RemovePrefix | ( | const tstring & | prefix | ) |
Remove the prefix if it is present.
Return an NString striped out of the prefix contained in prefix.
Definition at line 971 of file TextString.cpp.
References IsPrefix().
{ if (IsPrefix (prefix) ) { t_size l = prefix.length(); *this = NString (m_string.substr (l) ); } }
void nux::NString::RemovePrefix | ( | const TCHAR * | prefix | ) |
Remove the prefix if it is present.
Return an NString striped out of the prefix contained in prefix.
Definition at line 961 of file TextString.cpp.
References IsPrefix().
{ if (IsPrefix (prefix) ) { t_size l = StringLength (prefix); *this = NString (m_string.substr (l) ); } }
void nux::NString::RemoveSuffix | ( | const NString & | suffix | ) |
Remove the suffix if it is present.
Return an NString without the NString 'suffix'.
Definition at line 942 of file TextString.cpp.
References FindLastOccurence(), and IsSuffix().
{ if (IsSuffix (suffix) ) { t_size pos = FindLastOccurence (suffix); *this = NString (m_string.substr (0, pos) ); } }
void nux::NString::RemoveSuffix | ( | const tstring & | suffix | ) |
Remove the suffix if it is present.
Return an NString without the tstring 'suffix'.
Definition at line 932 of file TextString.cpp.
References FindLastOccurence(), and IsSuffix().
{ if (IsSuffix (suffix) ) { t_size pos = FindLastOccurence (suffix); *this = NString (m_string.substr (0, pos) ); } }
void nux::NString::RemoveSuffix | ( | const TCHAR & | suffix | ) |
Remove the suffix if it is present.
Return an NString without the character contained in suffix.
Definition at line 912 of file TextString.cpp.
References FindLastOccurence(), and IsSuffix().
Referenced by nux::EditTextBox::GetCleanText(), nux::NFileName::RemoveBackSlashAtEnd(), and nux::NFileName::RemoveSlashAtEnd().
{ if (IsSuffix (suffix) ) { t_size pos = FindLastOccurence (suffix); *this = NString (m_string.substr (0, pos) ); } }
void nux::NString::RemoveSuffix | ( | const TCHAR * | suffix | ) |
Remove the suffix if it is present.
Return an NString without the character string 'suffix'.
Definition at line 922 of file TextString.cpp.
References FindLastOccurence(), and IsSuffix().
{ if (IsSuffix (suffix) ) { t_size pos = FindLastOccurence (suffix); *this = NString (m_string.substr (0, pos) ); } }
nux::NString::VARARG_DECL | ( | static | NString, |
static | NString, | ||
return | , | ||
Printf | , | ||
VARARG_NONE | , | ||
const TCHAR * | , | ||
VARARG_NONE | , | ||
VARARG_NONE | |||
) |
Behave like printf. Use an internal buffer of 1024 characters. Do not use this function if you are expecting the result to be more that 1024-1 characters.