Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2022252
  • 博文数量: 414
  • 博客积分: 10312
  • 博客等级: 上将
  • 技术积分: 4921
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-31 01:49
文章分类

全部博文(414)

文章存档

2011年(1)

2010年(29)

2009年(82)

2008年(301)

2007年(1)

分类: C/C++

2009-01-04 14:56:05

String class

String objects are a special type of container, specifically designed to operate with sequences of characters.

Unlike traditional c-strings, which are mere sequences of characters in a memory array, C++ string objects belong to a class with many built-in features to operate with strings in a more intuitive way and with some additional useful features common to C++ containers.

The string class is an instantiation of the basic_string class template, defined in as:

typedef basic_string<char> string;

Member functions

Construct string object (constructor member)
String assignment (public member function)

Iterators:

Return iterator to beginning (public member function)
Return iterator to end (public member function)
Return reverse iterator to reverse beginning (public member function)
Return reverse iterator to reverse end (public member function)

Capacity:

Return length of string (public member function)
Return length of string (public member function)
Return maximum size of string (public member function)
Resize string (public member function)
Return size of allocated storage (public member function)
Request a change in capacity (public member function)
Clear string (public member function)
Test if string is empty (public member function)

Element access:

Get character in string (public member function)
Get character in string (public member function)

Modifiers:

Append to string (public member function)
Append to string (public member function)
Append character to string (public member function)
Assign content to string (public member function)
Insert into string (public member function)
Erase characters from string (public member function)
Replace part of string (public member function)
Copy sequence of characters from string (public member function)
Swap contents with another string (public member function)

String operations:

Get C string equivalent (public member function)
Get string data (public member function)
Get allocator (public member function)
Find content in string (public member function)
Find last occurrence of content in string (public member function)
Find character in string (public member function)
Find character in string from the end (public member function)
Find absence of character in string
Find absence of character in string from the end (public member function)
Generate substring (public member function)
Compare strings (public member function)
阅读(1065) | 评论(0) | 转发(0) |
0

上一篇:vector::reserve

下一篇:string

给主人留下些什么吧!~~