Strings library
来自cppreference.com
< cpp
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
C + +字符串库包括支持两个一般类型的字符串
原文:
The C++ strings library includes support for two general types of strings:
- std::basic_string - 设计一个模板类来处理字符串的任何字符类型.原文:std::basic_string - a templated class designed to manipulate strings of any character type.
- NULL结尾的字符串 - 由一个特殊的“空”字符结尾的字符数组.原文:Null-terminated strings - arrays of characters terminated by a special null character.
目录 |
[编辑] std::basic_string
模板类std::basic_string概括了如何操纵和存储的字符序列。字符串创建,操纵和破坏,都是通过一个方便的设置的类的方法和相关的功能.
原文:
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.
一些专业std::basic_string提供常用的类型
原文:
Several specializations of std::basic_string are provided for commonly-used types:
在头文件
<string> 中定义 | |
类型
|
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结尾的字符串.
原文:
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.
有三种类型的空终止字符串
原文:
There are three types of null-terminated strings:
[编辑] 额外的支持
[编辑] char_traits
的字符串库还提供了类的模板
char_traits
,定义类型和函数std::basic_string。以下专业的定义原文:
The string library also provides class template
char_traits
that defines types and functions for std::basic_string. The following specializations are defined: 在头文件 <string> 中定义
|
||
template<> class char_traits<std::string>; template<> class char_traits<std::wstring>; |
(C++11 起) (C++11 起) |
|