Strings library
来自cppreference.com
< cpp
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
C + +字符串库包括支持两个一般类型的字符串
Original:
The C++ strings library includes support for two general types of strings:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- std::basic_string - 设计一个模板类来处理字符串的任何字符类型.Original:std::basic_string - a templated class designed to manipulate strings of any character type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - NULL结尾的字符串 - 由一个特殊的“空”字符结尾的字符数组.Original:Null-terminated strings - arrays of characters terminated by a special null character.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] std::basic_string
模板类std::basic_string概括了如何操纵和存储的字符序列。字符串创建,操纵和破坏,都是通过一个方便的设置的类的方法和相关的功能.
Original:
The templated class std::basic_string generalizes how sequences of characters are manipulated and stored. String creation, manipulation, and destruction are all handled by a convenient set of class methods and related functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
一些专业std::basic_string提供常用的类型
Original:
Several specializations of std::basic_string are provided for commonly-used types:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Defined in header
<string> | |
类型
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
std::string | std::basic_string<char> |
std::wstring | std::basic_string<wchar_t> |
std::u16string | std::basic_string<char16_t> |
std::u32string | std::basic_string<char32_t> |
[编辑] null结尾的字符串
null结尾的字符串数组,通过一个特殊的“空”字符的字符被终止。 C + +提供的功能来创建,检查和修改null结尾的字符串.
Original:
Null-terminated strings are arrays of characters that are terminated by a special null character. C++ provides functions to create, inspect, and modify null-terminated strings.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
有三种类型的空终止字符串
Original:
There are three types of null-terminated strings:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 额外的支持
[编辑] char_traits
的字符串库还提供了类的模板
char_traits
,定义类型和函数std::basic_string。以下专业的定义Original:
The string library also provides class template
char_traits
that defines types and functions for std::basic_string. The following specializations are defined:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Defined in header <string>
|
||
template<> class char_traits<std::string>; template<> class char_traits<std::wstring>; |
(C++11 起) (C++11 起) |
|