Share via


CStringT::operator +=

Concatenates characters to the end of the string.

CStringT& operator+=(
   const CThisSimpleString& str
);
template<
   bool bMFCDLL
>
CStringT& operator+=(
   const const CSimpleStringT<BaseType, bMFCDLL>& str
);
template<
   int t_nSize
>
CStringT& operator+=(
   const CStaticString< XCHAR, t_nSize >& strSrc
);
CStringT& operator+=(
   PCXSTR pszSrc
);
CStringT& operator+=(
   PCYSTR pszSrc
);
CStringT& operator+=(
   char ch
);
CStringT& operator+=(
   unsigned char ch
);
CStringT& operator+=(
   wchar_t ch
);
CStringT& operator+=(
   const VARIANT& var
);

Parameters

  • str
    A reference to a CThisSimpleString object.

  • bMFCDLL
    A boolean specifying whether the project is an MFC DLL or not.

  • BaseType
    The string base type.

  • var
    A variant object to concatenate to this string.

  • ch
    An ANSI or Unicode character to concatenate with a string.

  • pszSrc
    A pointer to the original string being concatenated.

  • strSrc
    A CStringT to concatenate to this string.

Remarks

The operator accepts another CStringT object, a character pointer, or a single character. You should be aware that memory exceptions can occur whenever you use this concatenation operator because new storage can be allocated for characters added to this CStringT object.

For information on CThisSimpleString, see the Remarks section of CStringT::CStringT.

Note

Although it is possible to create CStringT instances that contain embedded null characters, we recommend against it. Calling methods and operators on CStringT objects that contain embedded null characters can produce unintended results.

Example

// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

CAtlString s(_T("abc"));
ASSERT((s += _T("def")) == _T("abcdef"));   

Requirements

Header: cstringt.h

See Also

Reference

CStringT Class