C++ string class
来源:互联网 发布:光通讯网络交换机 编辑:程序博客网 时间:2024/06/18 18:23
1int compare(const basic_string& str) constnoexcept;
对于traits::compare(data(),str.data(),rlen)
typedef char char_type;
static int compare(const char_type* s1, const char_type* s2, size_tn);
--------------------------------------------------
2int compare(const basic_string&str) const noexcept;
s.compare(s); //相等
--------------------------------------------------
3intcompare(size_typepos1, size_type n1,const basic_string&str,size_type pos2, size_type n2 ) const;
Returns:basic_string(*this, pos1,n1).compare(basic_string(str, pos2, n2)).
4
Returns:basic_string(*this,pos1,n1).compare(str).
s.compare(0,2,s);//用”ab”和”abcd”进行比较
比较3和4这两个函数,seeking猜测:pos2、n2是带有默认值0的参数
补充说明:typedef
--------------------------------------------------
5intcompare(size_type pos, size_type n1,const charT *s, size_type n2)const;
6intcompare(size_type pos, size_type n1,const charT *s)const;
s.compare(1,2,”bcx”,2); //用”bc”和”bc”比较。
s.compare(1,2,”bcx”);//用”bc”和”bcx”比较。
补充说明:charT是模板参数,表示变量的数据类型。关于charT参见string class的定义。
--------------------------------------------------- c/c++ splitting string class
- String Class
- String Class
- class string
- 【C++】实现一个简洁版的class String
- StrVec and String Class Design(C++Primer 5th)
- C.Class
- [C++]Class
- The C++ String Class
- C++ string Class 使用
- Using String class constructors
- string class STL心得
- Fast VBScript string class
- string class的实现
- class String 的实现
- C++ string class
- implementation of string class
- String class by C++
- zxing 黑屏 无法显示图像问题 及中文乱码问题解决
- 单表密码的C语言实现
- C++ string构造函数详解
- 让人头痛的软回车符替换成回车符
- 我的第一个Android软件作品
- C++ string class
- warning C4715: 'compare' : not all control pathsreturn a value
- C++函数模板
- 数组引用语法表达
- C++ for_each函数\for_each模板
- 本地MSDN Libary突然打不开
- C++ typename关键字的作用
- 7z格式多卷压缩文件使用winRAR解压…
- windows上的cmd内中粘贴复制方便方…