本文整理汇总了C++中StringX::find_first_of方法的典型用法代码示例。如果您正苦于以下问题:C++ StringX::find_first_of方法的具体用法?C++ StringX::find_first_of怎么用?C++ StringX::find_first_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringX
的用法示例。
在下文中一共展示了StringX::find_first_of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPathElem
// XXX taken from Windows PWSTreeCtrl.cpp
// XXX move to core
static StringX GetPathElem(StringX &sxPath)
{
// Get first path element and chop it off, i.e., if
// path = "a.b.c.d"
// will return "a" and path will be "b.c.d"
// path = "a..b.c.d"
// will return "a." and path will be "b.c.d"
// (assuming GROUP_SEP is '.')
StringX sxElement;
size_t dotPos = sxPath.find_first_of(GROUP_SEP);
size_t len=sxPath.length();
if (dotPos == StringX::npos){
sxElement = sxPath;
sxPath = wxT("");
} else {
while ((dotPos < len) && (sxPath[dotPos] == GROUP_SEP)) {// look for consecutive dots
dotPos++;
}
if (dotPos < len) {
sxElement = sxPath.substr(0, dotPos-1);
sxPath = sxPath.substr(dotPos);
}
else { // trailing dots
sxElement = sxPath;
sxPath = wxT("");
}
}
return sxElement;
}