本文整理汇总了C++中wstring::rend方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::rend方法的具体用法?C++ wstring::rend怎么用?C++ wstring::rend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::rend方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trimright
void StrUtils::trimright( wstring& s )
{
wstring::difference_type dt;
wstring::reverse_iterator it;
for( it = s.rbegin(); it != s.rend(); it++ )
if( !StrUtils::isspace( *it ) )
break;
dt = s.rend() - it;
s.erase( s.begin() + dt, s.end() );
}
示例2: ErasePunctuation
void ErasePunctuation(wstring& str, bool keep_trailing) {
auto rlast = str.rbegin();
if (keep_trailing)
rlast = std::find_if(str.rbegin(), str.rend(),
[](wchar_t c) -> bool {
return !(c == L'!' || // "Hayate no Gotoku!", "K-ON!"...
c == L'+' || // "Needless+"
c == L'\''); // "Gintama'"
});
auto it = std::remove_if(str.begin(), rlast.base(),
[](int c) -> bool {
// Control codes, white-space and punctuation characters
if (c <= 255 && !isalnum(c))
return true;
// Unicode stars, hearts, notes, etc. (0x2000-0x2767)
if (c > 8192 && c < 10087)
return true;
// Valid character
return false;
});
if (keep_trailing)
std::copy(rlast.base(), str.end(), it);
str.resize(str.size() - (rlast.base() - it));
}
示例3: isHuli
bool isHuli(const wstring &hid) {
if(hid.empty())
return true;
int stat = 0;
bool continuestat = true;
for(std::wstring::const_reverse_iterator it = hid.rbegin(); it != hid.rend(); ++it) {
switch(stat) {
case 0:
if(*it == _T('F') || *it == _T('S') || *it == _T('U') || *it == _T('G'))
{
stat = 1;
} else if(iswdigit(*it)) {
stat = 4;
} else {
continuestat = false;
}
break;
case 1:
if(*it == _T('@')) {
stat = 2;
} else {
continuestat = false;
}
break;
case 2:
if(*it == _T('_')) {
stat = 3;
} else {
continuestat = false;
}
break;
case 3:
if(!iswdigit(*it)) {
continuestat = false;
} else {
stat = 4;
}
break;
case 4:
if(!iswdigit(*it)) {
continuestat = false;
}
break;
}
if(!continuestat) {
break;
}
}
return continuestat && stat == 4;
}
示例4: trim
wstring trim( wstring text)
{
text.erase( text.begin(), find_if( text.begin(), text.end(), not1( ptr_fun<wint_t, int>( iswspace ) ) ) );
text.erase( find_if( text.rbegin(), text.rend(), not1( ptr_fun<wint_t, int>( iswspace ) )).base(), text.end() );
return text;
}
示例5: RightTrim
wstring StringUtilities::RightTrim(wstring str)
{
str.erase(find_if(str.rbegin(), str.rend(), not1(std::ptr_fun<int, int>(std::isspace))).base(), str.end());
return str;
}