예제 #1
0
	size_t string::rfind(char c, size_t pos) const
	{
		pos = changeVarWhenEuqalNPOS(pos, size(), 1);
		for (auto cit = cbegin() + pos; cit >= cbegin(); --cit)
		{
			if (*cit == c)
				return cit - cbegin();
		}
		return npos;
	}
예제 #2
0
	size_t string::find_last_not_of(char c, size_t pos) const
	{
		pos = changeVarWhenEuqalNPOS(pos, size(), 1);
		for (int i = pos; i >= 0; --i)
		{
			if ((*this)[i] != c)
				return i;
		}
		return npos;
	}
예제 #3
0
 string::string(const string &str, size_t pos, size_t len){
     len = changeVarWhenEuqalNPOS(len, str.size(), pos);
     allocateAndCopy(str.start_ + pos, str.start_ + pos + len);
 }
예제 #4
0
 string& string::append(const string& str, size_t subpos, size_t sublen){
     sublen = changeVarWhenEuqalNPOS(sublen, str.size(), subpos);
     insert(size(),str,subpos,sublen);
     return *this;
 }
예제 #5
0
	size_t string::find_last_not_of(const char* s, size_t pos) const
	{
		pos = changeVarWhenEuqalNPOS(pos, size(), 1);
		return find_last_not_of(s, pos, strlen(s));
	}
예제 #6
0
	size_t string::find_last_not_of(const string& str, size_t pos) const
	{
		pos = changeVarWhenEuqalNPOS(pos, size(), 1);
		return find_last_not_of(str.begin(), pos, str.size());
	}
예제 #7
0
	size_t string::rfind(const char* s, size_t pos) const
	{
		pos = changeVarWhenEuqalNPOS(pos, size(), 1);
		return rfind(s, pos, strlen(s));
	}
예제 #8
0
	size_t string::rfind(const string& str, size_t pos) const
	{
		auto lengthOfS = str.size();
		pos = changeVarWhenEuqalNPOS(pos, size(), 1);
		return rfind_aux(str.begin(), pos, lengthOfS, 0);
	}
예제 #9
0
	string& string::replace(size_t pos, size_t len, const string& str, size_t subpos, size_t sublen)
	{
		sublen = changeVarWhenEuqalNPOS(sublen, str.size(), subpos);
		return replace(begin() + pos, begin() + pos + len, str.begin() + subpos, str.begin() + subpos + sublen);
	}
예제 #10
0
	string& string::erase(size_t pos, size_t len)
	{
		len = changeVarWhenEuqalNPOS(len, size(), pos);
		erase(begin() + pos, begin() + pos + len);
		return *this;
	}
예제 #11
0
	string& string::insert(size_t pos, const string& str, size_t subpos, size_t sublen)
	{
		sublen = changeVarWhenEuqalNPOS(sublen, str.size(), subpos);
		insert(begin() + pos, str.begin() + subpos, str.begin() + subpos + sublen);
		return *this;
	}