免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5125 | 回复: 7
打印 上一主题 下一主题

[C++] 谁能详细c++中string类中函数成员的用法 [复制链接]

投石问路 该用户已被删除
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-06-13 12:33 |只看该作者 |倒序浏览
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
2 [报告]
发表于 2003-06-13 16:10 |只看该作者

谁能详细c++中string类中函数成员的用法

----------------------------
basic_string Members
----------------------------

*allocator_type  A type that represents the allocator class for a string object.

*const_iterator  A type that provides a random-access iterator that can access and read a const element in the string.
const_pointer  A type that provides a pointer to a const element in a string.

*const_reference  A type that provides a reference to a const element stored in a string for reading and performing const operations.

*const_reverse_iterator  A type that provides a random-access iterator that can read any const element in the string.

*difference_type  A type that provides the difference between two iterators that refer to elements within the same string.
iterator  A type that provides a random-access iterator that can read or modify any element in a string.

*npos An unsigned integral value initialized to –1 that indicates either "not found" or "all remaining characters" when a search function fails.

*pointer  A type that provides a pointer to a character element in a string or character array.
reference  A type that provides a reference to an element stored in a string.

*reverse_iterator  A type that provides a random-access iterator that can read or modify an element in a reversed string.

*size_type  An unsigned integral type for the number of elements in a string.

*traits_type  A type for the character traits of the elements stored in a string.  

*value_type  A type that represents the type of characters stored in a string.

-----------------------
Member Functions
-----------------------

+append  Adds characters to the end of a string.

+assign  Assigns new character values to the contents of a string.

+at  Returns a reference to the element at a specified location in the string.

+basic_string  Constructs a string that is empty or initialized by specific characters or that is a copy of all or part of some other string object or C-string.

+begin  Returns an iterator addressing the first element in the string.

+c_str  Converts the contents of a string as a C-style, null-terminated, string.

+capacity  Returns the largest number of elements that could be stored in a string without increasing the memory allocation of the string.

+clear  Erases all elements of a string.

+compare  Compares a string with a specified string to determine if the two strings are equal or if one is lexicographically less than the other.

+copy  Copies at most a specified number of characters from an indexed position in a source string to a target character array.

+data  Converts the contents of a string into an array of characters.

+empty  Tests whether the string is contains characters or not.
end  Returns an iterator that addresses the location succeeding the last element in a string.

+erase  Removes an element or a range of elements in a string from specified positions.

+find  Searches a string in a forward direction for the first occurrence of a substring that matches a specified sequence of characters.

+find_first_not_of Searches through a string for the first character that is not any element of a specified string.

+find_first_of  Searches through a string for the first character that matches any element of a specified string.

+find_last_not_of  Searches through a string for the last character that is not any element of a specified string.

+find_last_of  Searches through a string for the last character that is an element of a specified string.

+get_allocator  Returns a copy of the allocator object used to construct the string.

+insert  Inserts an element or a number of elements or a range of elements into the string at a specified position.

+length  Returns the current number of elements in a string.

+max_size  Returns the maximum number of characters a string could contain.

+push_back  Adds an element to the end of the string.
rbegin  Returns an iterator to the first element in a reversed string.

+rend  Returns an iterator that points just beyond the last element in a reversed string.

+replace  Replaces elements in a string at a specified position with specified characters or characters copied from other ranges or strings or C-strings.

+reserve  Sets the capacity of the string to a number at least as great as a specified number.

+resize  Specifies a new size for a string, appending or erasing elements as required.

+rfind  Searches a string in a backward direction for the first occurrence of a substring that matches a specified sequence of characters.

+size  Returns the current number of elements in a string.
substr  Copies a substring of at most some number of characters from a string beginning from a specified position.

+swap  Exchange the contents of two strings.

-------------
Operators
-------------

operator+=  Appends characters to a string.

operator=  Assigns new character values to the contents of a string.

operator[] Provides a reference to the character with a specified index in a string.

All of those above was copyed from MSDN 2003 Apr
投石问路 该用户已被删除
3 [报告]
发表于 2003-06-13 17:50 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
投石问路 该用户已被删除
4 [报告]
发表于 2003-06-13 18:04 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
5 [报告]
发表于 2003-06-13 18:23 |只看该作者

谁能详细c++中string类中函数成员的用法

噢  god E文

论坛徽章:
0
6 [报告]
发表于 2003-06-13 20:17 |只看该作者

谁能详细c++中string类中函数成员的用法

太多了啊,我看不明白啊

论坛徽章:
0
7 [报告]
发表于 2003-06-13 21:29 |只看该作者

谁能详细c++中string类中函数成员的用法

www.sgi.com/tech/stl

里面有string的帮助

并有源码可以DOWN
投石问路 该用户已被删除
8 [报告]
发表于 2003-06-14 11:26 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP