本文整理汇总了C++中xr_string::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_string::empty方法的具体用法?C++ xr_string::empty怎么用?C++ xr_string::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xr_string
的用法示例。
在下文中一共展示了xr_string::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWord
bool CUILine::GetWord(Word& w, const xr_string& text, int begin) const{
if (text.empty())
return false;
StrSize first, last, lastsp/*last space*/;
first = text.find_first_not_of(' ', begin);
last = text.find_first_of(' ', first);
if( npos==last && npos==first )
return false;
if( npos==last && npos!=first )
{
w.pos = (int)first;
w.len = (int)(text.length()-first);
w.len_full = w.len;
return true;
}
lastsp = text.find_first_not_of(' ', last);
if (npos == lastsp && npos == first) // maybe we have string only with spaces
{
first = text.find_first_of(' ',begin);
last = text.find_last_of(' ',begin);
if (npos == first) //suxxx it is empty string
return false;
w.pos = (int)first;
w.len = (int)(last - first + 1);
w.len_full = w.len;
return true;
}
if (npos == lastsp)
lastsp = last;
else
--lastsp;
if (npos == last && npos != first)
last = text.size() - 1;
else
--last;
if (npos == lastsp)
lastsp = last;
first = begin;
w.pos = (int) first;
w.len = (int)(last - first + 1);
w.len_full = (int)(lastsp - first + 1);
#ifdef DEBUG
if (npos != first && (npos == last || npos == lastsp ))
R_ASSERT2(false,"CUILine::InitPos -- impossible match");
#endif
return true;
}