nux-0.9.46

nux::NString Class Reference

#include <NuxCore/TextString.h>

Inheritance diagram for nux::NString:
nux::NFileName

Public Member Functions

 NString ()
 NString (const NString &s)
 NString (const tstring &s)
 NString (const TCHAR &s)
 NString (const ANSICHAR *s)
 NString (const UNICHAR *s)
 ~NString ()
NStringoperator= (const NString &s)
const tstring & GetTStringRef () const
const TCHARGetTCharPtr () const
t_size Length () const
t_size Size () const
void Clear ()
bool IsEmpty () const
void Erase (t_size Pos, t_size count)
NStringInsert (t_size Pos, const TCHAR *Ptr)
NStringInsert (t_size Pos, const TCHAR *Ptr, t_size Count)
NStringInsert (t_size Pos, const tstring &Str)
NStringInsert (t_size Pos, const tstring &Str, t_size Offset, t_size Count)
NStringInsert (t_size Pos, const NString &Str)
NStringInsert (t_size Pos, const NString &Str, t_size Offset, t_size Count)
NStringInsert (t_size Pos, int Count, const TCHAR &Ch)
const TCHARoperator[] (t_size ChPos) const
TCHARoperator[] (t_size ChPos)
NStringReplace (t_size Pos1, t_size Num1, const TCHAR *Ptr)
NStringReplace (t_size Pos1, t_size Num1, const TCHAR *Ptr, t_size Num2)
NStringReplace (t_size Pos1, t_size Num1, const tstring &Str)
NStringReplace (t_size Pos1, t_size Num1, const tstring &Str, t_size Pos2, t_size Num2)
NStringReplace (t_size Pos1, t_size Num1, const NString &Str)
NStringReplace (t_size Pos1, t_size Num1, const NString &Str, t_size Pos2, t_size Num2)
NStringReplace (t_size Pos1, t_size Num1, t_size Count, TCHAR Ch)
void Reverse ()
 Reverse the string.
NStringSearchAndReplace (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 TCHARoperator() () const
const TCHARoperator* () const
NStringoperator+= (const TCHAR &sufix)
 Append a character to this string.
NStringoperator+= (const TCHAR *sufix)
 Append a TCHAR* to this string.
NStringoperator+= (const tstring sufix)
 Append a tstring to this string.
NStringoperator+= (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)

Data Fields

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)

Constructor & Destructor Documentation

nux::NString::NString ( )
nux::NString::NString ( const NString s)
nux::NString::NString ( const tstring &  s)
nux::NString::NString ( const TCHAR s)
nux::NString::NString ( const ANSICHAR s)
nux::NString::NString ( const UNICHAR s)
nux::NString::~NString ( )

Member Function Documentation

void nux::NString::Clear ( )
void nux::NString::Erase ( t_size  Pos,
t_size  count 
)
t_size nux::NString::Find ( NString  str,
int  start = 0 
)

Searches this string for the first match of a substring.

t_size nux::NString::Find ( TCHAR  c,
int  start = 0 
)

Searches this string for the first match of a character.

t_size nux::NString::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 nux::NString::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 nux::NString::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 nux::NString::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 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.

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.

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.

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.

t_size nux::NString::FindLastOccurence ( const TCHAR suffix) const

Return The last position of the substring suffix or -1 if it is not found.

t_size nux::NString::FindLastOccurence ( const tstring &  suffix) const

Return The last position of the substring suffix or -1 if it is not found.

t_size nux::NString::FindLastOccurence ( const TCHAR suffix) const

Return The last position of the substring suffix or -1 if it is not found.

t_size nux::NString::FindLastOccurence ( const NString suffix) const

Return The last position of the substring suffix or -1 if it is not found.

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.

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.

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.

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.

t_size nux::NString::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 nux::NString::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 nux::NString::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 nux::NString::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.

TCHAR nux::NString::GetFirstChar ( ) const

Get first character.

Returns:
The first character or 0 if the string is empty.
TCHAR nux::NString::GetLastChar ( ) const

Get last character.

Returns:
The last character or 0 if the string is empty.
NString nux::NString::GetSubString ( t_size  count) const

Return an NString of the first count characters.

NString nux::NString::GetSubString ( t_size  start,
t_size  count 
) const

Return an NString of the first count characters starting at position start.

const tstring& nux::NString::GetTStringRef ( ) const
NString& nux::NString::Insert ( t_size  Pos,
const TCHAR Ptr 
)
NString& nux::NString::Insert ( t_size  Pos,
const TCHAR Ptr,
t_size  Count 
)
NString& nux::NString::Insert ( t_size  Pos,
const tstring &  Str 
)
NString& nux::NString::Insert ( t_size  Pos,
const tstring &  Str,
t_size  Offset,
t_size  Count 
)
NString& nux::NString::Insert ( t_size  Pos,
const NString Str 
)
NString& nux::NString::Insert ( t_size  Pos,
const NString Str,
t_size  Offset,
t_size  Count 
)
NString& nux::NString::Insert ( t_size  Pos,
int  Count,
const TCHAR Ch 
)
bool nux::NString::IsEmpty ( ) const
bool nux::NString::IsPrefix ( const TCHAR prefix)

Return True if the string start with the character contained in prefix.

bool nux::NString::IsPrefix ( const TCHAR prefix)

Return True if the string start with the character string contained in prefix.

bool nux::NString::IsPrefix ( const tstring &  prefix)

Return True if the string start with the tstring contained in prefix.

bool nux::NString::IsPrefix ( const NString prefix)

Return True if the string start with the NString contained in prefix.

bool nux::NString::IsSuffix ( const TCHAR suffix)

Return True if the string is terminated by the character 'suffix'.

bool nux::NString::IsSuffix ( const TCHAR suffix)

Return True if the string is terminated by the character string 'suffix'.

bool nux::NString::IsSuffix ( const tstring &  suffix)

Return True if the string is terminated by the tstring 'suffix'.

bool nux::NString::IsSuffix ( const NString suffix)

Return True if the string is terminated by the NString 'suffix'.

NString nux::NString::Left ( t_size  N) const

Extracts the left part of a string. At most N characters are extracted.

NString nux::NString::Mid ( t_size  count) const

Extracts the first N characters..

NString nux::NString::Mid ( t_size  start,
t_size  count 
) const

Extracts the middle part of a string.

const TCHAR* nux::NString::operator() ( ) const
const TCHAR* nux::NString::operator* ( ) const
NString& nux::NString::operator+= ( const TCHAR sufix)

Append a character to this string.

NString& nux::NString::operator+= ( const TCHAR sufix)

Append a TCHAR* to this string.

NString& nux::NString::operator+= ( const tstring  sufix)

Append a tstring to this string.

NString& nux::NString::operator+= ( const NString  sufix)

Append an NString to this string.

NString& nux::NString::operator= ( const NString s)
const TCHAR& nux::NString::operator[] ( t_size  ChPos) const
TCHAR& nux::NString::operator[] ( t_size  ChPos)
void nux::NString::ParseToArray ( std::vector< NString > &  StringArray,
const NString delimiter 
)
void nux::NString::RemovePrefix ( const TCHAR prefix)

Remove the prefix if it is present.

void nux::NString::RemovePrefix ( const NString prefix)

Remove the prefix if it is present.

void nux::NString::RemovePrefix ( const tstring &  prefix)

Remove the prefix if it is present.

void nux::NString::RemovePrefix ( const TCHAR prefix)

Remove the prefix if it is present.

void nux::NString::RemoveSuffix ( const NString suffix)

Remove the suffix if it is present.

void nux::NString::RemoveSuffix ( const tstring &  suffix)

Remove the suffix if it is present.

void nux::NString::RemoveSuffix ( const TCHAR suffix)

Remove the suffix if it is present.

void nux::NString::RemoveSuffix ( const TCHAR suffix)

Remove the suffix if it is present.

NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
const NString Str,
t_size  Pos2,
t_size  Num2 
)
NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
const TCHAR Ptr,
t_size  Num2 
)
NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
const TCHAR Ptr 
)
NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
const tstring &  Str,
t_size  Pos2,
t_size  Num2 
)
NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
const NString Str 
)
NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
t_size  Count,
TCHAR  Ch 
)
NString& nux::NString::Replace ( t_size  Pos1,
t_size  Num1,
const tstring &  Str 
)
void nux::NString::Reverse ( )

Reverse the string.

NString nux::NString::Right ( t_size  N) const

Extracts the right part of a string. At most N characters are extracted.

NString& nux::NString::SearchAndReplace ( TCHAR  ChOut,
TCHAR  ChIn 
)

Replace character ChOut with ChIn in the string.

t_size nux::NString::Size ( ) const
void nux::NString::SplitAtFirstOccurenceOf ( const TCHAR SplitChar,
NString Left,
NString Right 
)
void nux::NString::SplitAtFirstOccurenceOf ( const TCHAR SplitString,
NString Left,
NString Right 
)
void nux::NString::SplitAtFirstOccurenceOf ( const NString SplitString,
NString Left,
NString Right 
)
void nux::NString::SplitAtLastOccurenceOf ( const NString SplitString,
NString Left,
NString Right 
)
void nux::NString::SplitAtLastOccurenceOf ( const TCHAR SplitString,
NString Left,
NString Right 
)
void nux::NString::SplitAtLastOccurenceOf ( const TCHAR SplitChar,
NString Left,
NString Right 
)
NString nux::NString::Trim ( ) const

Trims all leading and trailing whitespace characters from the string.

NString nux::NString::TrimLeft ( ) const

Trim the white space characters at the start of this string. Return a trimmed NString.

NString nux::NString::TrimLeft ( NString  str) const

Trim any of the characters in the argument string. Return a trimmed NString.

NString nux::NString::TrimRight ( ) const

Trim the white space characters at the end of this string. Return a trimmed NString.

NString nux::NString::TrimRight ( NString  str) const

Trim any of the characters in the argument string. Return a trimmed NString.

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.

Returns:
A string with formated arguments in a NString.

Friends And Related Function Documentation

bool operator!= ( const NString left,
const NString right 
) [friend]
NString operator+ ( const NString left,
const TCHAR right 
) [friend]
NString operator+ ( const TCHAR  left,
const NString right 
) [friend]
NString operator+ ( const NString left,
const TCHAR  right 
) [friend]
NString operator+ ( const TCHAR left,
const NString right 
) [friend]
NString operator+ ( const NString left,
const NString right 
) [friend]
bool operator< ( const NString left,
const NString right 
) [friend]
tostream& operator<< ( tostream &  o,
const NString s 
) [friend]
bool operator<= ( const NString left,
const NString right 
) [friend]
bool operator== ( const NString left,
const NString right 
) [friend]
bool operator> ( const NString left,
const NString right 
) [friend]
bool operator>= ( const NString left,
const NString right 
) [friend]

Field Documentation


The documentation for this class was generated from the following file: