
C++ string
tianmo2010
这个作者很懒,什么都没留下…
展开
-
string_replace
string_replace的实现:#include #include std::string& string_replace(std::string &str, const std::string &old_value, const std::string &new_value) { while (true) { std::string::size_type原创 2011-08-16 14:53:44 · 1165 阅读 · 0 评论 -
string_split
string_split的实现:void string_split(const std::string &str, const std::string &sep, std::vector *strs, bool ignore_empty) { if (strs == NULL) { return ; } int start = 0; std::string temp = "原创 2011-05-17 22:49:00 · 3543 阅读 · 0 评论 -
string类中replace,find,大小写转换等应用
首先要说的是,其实我对foreach循环的用法并不是很精通,说详解,其实也只是我自己的理解,希望对你能有点帮助 。先来看一下foreach的语法:foreach ($array as $key=>$value){……}为了便于理解,我们假定这里的$array是一个一维的相关数组,$key是数组的索引,$value是这个索引的值,它们的名字可以随意,之原创 2012-06-30 19:45:27 · 2564 阅读 · 0 评论 -
string类详解
String类的构造函数和析构函数如下: a) string s; //生成一个空字符串s b) string s(str) //拷贝构造函数 生成str的复制品 c) string s(str,stridx) //将字符串str内"始于位置stridx"的部分当作字符串的初值 d) string s(str,stridx,strlen) //将字符串str内"始于stridx且长原创 2011-09-10 13:01:13 · 1670 阅读 · 0 评论 -
string类的实现
实现string类的构造函数,析构函数和赋值函数#include using namespace std;class String{public: //普通构造函数 String(const char *str = NULL); //拷贝构造函数 String(const String &other); //赋值构造函数 String & operator =原创 2012-04-12 15:45:35 · 1059 阅读 · 0 评论