本文整理汇总了C++中StdString::find_last_of方法的典型用法代码示例。如果您正苦于以下问题:C++ StdString::find_last_of方法的具体用法?C++ StdString::find_last_of怎么用?C++ StdString::find_last_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StdString
的用法示例。
在下文中一共展示了StdString::find_last_of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getClassPathExt
long Universe::getClassPathExt(vector<StdString>& tokens,
const StdString& arg) const {
#define EXT_TOKENS 2
long result = ERR_SUCCESS;
long fpIndex = arg.find_last_of(fileSeparator);
long ssepIndex = arg.find(".som");
if (fpIndex == StdString::npos) { //no new path
//different from CSOM (see also HandleArguments):
//we still want to strip the suffix from the filename, so
//we set the start to -1, in order to start the substring
//from character 0. npos is -1 too, but this is to make sure
fpIndex = -1;
//instead of returning here directly, we have to remember that
//there is no new class path and return it later
result = ERR_FAIL;
} else
tokens[0] = arg.substr(0, fpIndex);
//adding filename (minus ".som" if present) to second slot
ssepIndex =
((ssepIndex != StdString::npos) && (ssepIndex > fpIndex)) ?
(ssepIndex - 1) : arg.length();
tokens[1] = arg.substr(fpIndex + 1, ssepIndex - (fpIndex));
return result;
}