title
<string> | Microsoft Docs
ms.custom
ms.date
11/04/2016
ms.reviewer
ms.suite
ms.technology
ms.tgt_pltfrm
ms.topic
article
f1_keywords
std::<string>
string/std::<string>
std.<string>
<string>
dev_langs
helpviewer_keywords
ms.assetid
a2fb9d00-d7ae-4170-bfea-2dc337aa37cf
caps.latest.revision
23
author
corob-msft
ms.author
corob
manager
ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw
Defines the container template class basic_string and various supporting templates.
For more information about basic_string, see basic_string Class
Remarks
The C++ language and the C++ Standard Library support two types of strings:
Null-terminated character arrays often referred to as C strings.
Template class objects, of type basic_string, that handle all char-like template arguments.
string
A type that describes a specialization of the template class basic_string with elements of type char as a string.
wstring
A type that describes a specialization of the template class basic_string with elements of type wchar_t as a wstring.
u16string
A type that describes a specialization of the template class basic_string based on elements of type char16_t.
u32string
A type that describes a specialization of the template class basic_string based on elements of type char32_t.
operator+
Concatenates two string objects.
operator!=
Tests if the string object on the left side of the operator is not equal to the string object on the right side.
operator==
Tests if the string object on the left side of the operator is equal to the string object on the right side.
operator<
Tests if the string object on the left side of the operator is less than to the string object on the right side.
operator<=
Tests if the string object on the left side of the operator is less than or equal to the string object on the right side.
operator<<
A template function that inserts a string into the output stream.
operator>
Tests if the string object on the left side of the operator is greater than to the string object on the right side.
operator>=
Tests if the string object on the left side of the operator is greater than or equal to the string object on the right side.
operator>>
A template function that extracts a string from the input stream.
Specialized Template Functions
swap
Exchanges the arrays of characters of two strings.
stod
Converts a character sequence to a double.
stof
Converts a character sequence to a float.
stoi
Converts a character sequence to an integer.
stold
Converts a character sequence to a long double.
stoll
Converts a character sequence to a long long.
stoul
Converts a character sequence to an unsigned long.
stoull
Converts a character sequence to an unsigned long long.
to_string
Converts a value to a string.
to_wstring
Converts a value to a wide string.
basic_string Class
A template class that describes objects that can store a sequence of arbitrary character-like objects.
char_traits Struct
A template class that describes attributes associated with a character of type CharType
char_traits<char> Struct
A struct that is a specialization of the template struct char_traits<CharType> to an element of type char.
char_traits<wchar_t> Struct
A struct that is a specialization of the template struct char_traits<CharType> to an element of type wchar_t.
char_traits<char16_t> Struct
A struct that is a specialization of the template struct char_traits<CharType> to an element of type char16_t.
char_traits<char32_t> Struct
A struct that is a specialization of the template struct char_traits<CharType> to an element of type char32_t.
Header: <string>
Namespace: std
Header Files Reference
Thread Safety in the C++ Standard Library