下载此文档

c 中的string的用法总结(Usage Summary of string in c ).doc


文档分类:IT计算机 | 页数:约22页 举报非法文档有奖
1/22
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/22 下载此文档
文档列表 文档介绍
c++中的string的用法总结(Usage Summary of string in c++)
Basic_string:: append
Add characters or strings to the back of the string. (ratio = push_back, more flexible)
(1) add C-string to the back of the string
Basic_string& append (const value_type* _Ptr);
String s ("Hello"); / / s= Hello"
Const char *c = "Out There"";
(c); / / s= Hello Out There ""
(2) to a part of string followed by C-string
Basic_string& append (const value_type* _Ptr, size_type _Count);
String s ("Hello"); / / s= Hello"
Const char *c = "Out There"";
(C, 3); / / s= Hello Out"
(3) to string string (adding two methods)
Basic_string& append (const basic_string& _Str);
String S1 ("Hello"), S2 ("Wide"), S3 ("World");
(S2); / / s1= Hello Wide"
S1 = S3; / / s1= Hello Wide World ""
(4) to string by adding string part of ---A
Basic_string& append (const basic_string& _Str, size_type _Off,
Size_type _Count);
String S1 ("Hello"), S2 ("Wide World");
(S2, 5, 5); / / s1= Hello World"
(5) to string by adding string part of ---B
Template<class InputIterator> basic_string& (append
InputIterator _First, InputIterator _Last);
String str1f ("Hello"), str2f ("Wide World");
() () (+ 5);
"Hello World / / s1="
(6) to string behind the multiple character
Basic_string& append (size_type _Count, value_type _Ch);
String str1e ("Hello");
(4 '!'); / / s1= Hello!!!!"
Basic_string:: Assign
Assigning to string. (more flexible than "=")
(1) assign C-string to string
Basic_string& assign (const value_type* _Ptr);
String s;
Const char *c = "Out There"";
(c); / / s= Out There"
(2) assign a part of C-string to string
Basic_string& assign (const value_type* _Ptr, size_type _Count);
String s;
Const char *c = "Out There"";
(C, 3); / / s= Out"
(3) assign string to string (there are two methods)
Basic_string& assign (const basic_string& _Str);
String S1 ("Hello"), S2 ("Wide"), S3 ("World");

c 中的string的用法总结(Usage Summary of string in c ) 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数22
  • 收藏数0 收藏
  • 顶次数0
  • 上传人rjmy2261
  • 文件大小24 KB
  • 时间2017-11-13
最近更新