.. _ch02: Chapter 2. Strings and Text *************************** .. _iddle1345: .. _iddle1525: .. _iddle1588: .. _iddle1893: .. _iddle1952: .. _iddle2520: .. _iddle2560: .. _iddle2980: Strings come in a number of different character sets. COM components often need to use multiple character sets and occasionally need to convert from one set to another. ATL provides a number of string conversion classes that convert from one character set to another, if necessary, and do nothing when they are not needed. The ``CComBSTR`` class is a smart string class. This class properly allocates, copies, and frees a string according to the ``BSTR`` string semantics. ``CComBSTR`` instances can be used in most, but not all, of the places you would use a ``BSTR``. The ``CString`` class is a new addition to ATL, with roots in MFC. This class handles allocation, copying, formatting, and offers a host of advanced string-processing features. It can manage ANSI and Unicode data, and convert strings to and from ``BSTR`` s for use in processing Automation method parameters. With ``CString``, you can even control and customize the way memory is managed for the class's string data. .. include:: ch02lev1sec1.rest .. include:: ch02lev1sec2.rest .. include:: ch02lev1sec3.rest .. include:: ch02lev1sec4.rest .. include:: ch02lev1sec5.rest