Append to string

Web Site  Methods

 
Str::AppendChars
 
void AppendChars (const STRCHAR* s, CPOS howmany = (CPOS) -1)

This method will append a specified number of characters (howmany) to the end of the string object current value.

If the value for howmany is not specified (i.e. the default of -1 is used), or the value for howmany is greater than the length of s, the entire string at s will be appended.

 

 
Str::AppendString (C-style)
Equivalent to: Str::operator += (const STRCHAR*)
 

Str& AppendString (const STRACHAR* s)
Str& AppendString (const STRWCHAR* s)
void operator += (const STRACHAR* s)
void operator += (const STRWCHAR* s)
void operator += (const CString& s)

Versions that take wide-character strings available only on platforms that support Unicode.  Version accepting CString only available when compiling DLL/application with MFC support.

These two methods (and the two operator overloads, which have the exact same function) will append the string s at the end of the string object current value.

Platforms that support Unicode with accept both ANSI and Unicode strings to be catenated, regardless of the mode in which Str Library is compiled. When conversion needs to occur, however, performance will suffer somewhat.

For convenience, the AppendString methods return a self reference to the called object.

Example:

   Str s (_T("X "));
s += "Y "; // Uses the LPCSTR overload
s += Str(_T("Z ")); // Uses the const Str& overload
s.AppendString (_T("123"));
ASSERT (s == _T("X Y Z 123"));

 

 
Str::AppendString (Str-style)
Equivalent to: operator += (Str)
 
Str& AppendString (const Str& s)
void operator += (const Str& s)

This form of AppendString, and its equivalent += operator, will append the passed string at the end of the current object value.  See AppendString (C-style) above for example.

For convenience, AppendString returns a self reference to the called object (not to the passed source string!)

 

See also: Adding to Strings, Append other items to string