本文整理汇总了C++中str::end方法的典型用法代码示例。如果您正苦于以下问题:C++ str::end方法的具体用法?C++ str::end怎么用?C++ str::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类str
的用法示例。
在下文中一共展示了str::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disp
void disp(str v)
{ for (sit it=v.begin(); it!=v.end(); it++)
cout << *it << endl;
cout << endl;
}
示例2: count
/*************************************************
S.count(sub[, start[, end]]) -> uint
Return the number of non-overlapping occurrences of substring sub in
string S[start:end]. Optional arguments start and end are interpreted
as in slice notation.
*************************************************/
uint str::count(const str& sub, int start, int end) {
return ::count((start<0?s.end():s.begin())+start, (end<=0?s.end():s.begin())+end, sub.begin(), sub.end());
}
示例3: endswith
/*************************************************
S.endswith(suffix[, start[, end]]) -> bool
Return True if S ends with the specified suffix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
suffix can also be a tuple of strings to try.
*************************************************/
bool str::endswith(const str& prefix, int start, int end) const {
return ::endswith((start<0?s.end():s.begin())+start, (end<=0?s.end():s.begin())+end, prefix.begin(), prefix.end());
}
示例4: find
/*************************************************
S.find(sub [,start [,end]]) -> int
Search from left to right.
Return the lowest index in S where substring sub is found,
such that sub is contained within s[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
*************************************************/
int str::find(const str& sub, int start, int end) const {
citerator a=(start<0?s.end():s.begin())+start, b=(end<=0?s.end():s.begin())+end;
if (a>=b) return -1;
citerator c=std::search(a, b, sub.begin(), sub.end());
return (c==b)?-1:c-a;
}