======Strings library====== Strings of characters in C++ are commonly represented using the [[/string/basic_string/]] class. C++ also [[/string/c/|provides functions for manipulating C-style strings]], which are null-terminated arrays of characters. ====String class==== ==basic_string== Header '''' defines class template [[/string/basic_string/]] that generalizes the way how sequences of characters are manipulated and stored. It is defined as follows: template< typename CharT, typename Traits = std::char_traits, typename Allocator = std::allocator > > class basic_string; Also, several specializations of the class ''basic_string'' are provided: typedef basic_string string; typedef basic_string wstring; typedef basic_string u16string; //C++0x feature typedef basic_string u32string; //C++0x feature ==Functions== |[[getline]]|read data from an I/O stream into a string| ==Numeric conversions== The header '''' provides the following functions performing numeric conversion functions: |[[stoi | stoi, stol, stoll, stoul, stoull]] | converts the given string to an integer ([[/C++0x]] feature) | |[[stof | stof, stod, stold]] | converts the given string to an floating point value ([[/C++0x]] feature) | |[[to_string]] | converts the given integral or floating point value to ''string'' ([[/C++0x]] feature) | |[[to_wstring]] | converts the given integral or floating point value to ''wstring'' ([[/C++0x]] feature) | ==Hash support== The header '''' provides the following specializations of class template ''hash'' (see [[/utility/hash]]) | ''hash'' | template specialization, providing hash support for ''string'' string type ([[/C++0x]] feature)| | ''hash'' | template specialization, providing hash support for ''wstring'' string type ([[/C++0x]] feature)| | ''hash'' | template specialization, providing hash support for ''u16string'' string type ([[/C++0x]] feature)| | ''hash'' | template specialization, providing hash support for ''u32string'' string type ([[/C++0x]] feature)| ====char_traits==== Strings library provides [[char_traits]], a template class, defining types and functions for a character container. Several specializations are defined in header '''': | ''char_traits'' | template specialization, defining operations with ''char'' character type | | ''char_traits'' | template specialization, defining operations with ''wchar_t'' character type | | ''char_traits'' | template specialization, defining operations with ''char16_t'' character type ([[/C++0x]] feature)| | ''char_traits'' | template specialization, defining operations with ''char32_t'' character type ([[/C++0x]] feature)| ====C-style strings==== [[character_classes | Character classes]] [[/string/c/ | Null-terminated strings]] [[/string/cw/| Null-terminated wide strings]]