本文整理汇总了C++中SPString::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ SPString::substr方法的具体用法?C++ SPString::substr怎么用?C++ SPString::substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPString
的用法示例。
在下文中一共展示了SPString::substr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetUpperPath
SPString SPFileHelper::GetUpperPath( SPString path )
{
SPString result1 = L"";
SPString result2 = L"";
if (path.find_last_of(L"\\") != wstring::npos)
{
result2 = path.substr(0, path.find_last_of(L"\\"));
}
if (path.find_last_of(L"/") != wstring::npos)
{
result1 = path.substr(0, path.find_last_of(L"/"));
}
return result1.size() > result2.size() ? result1 : result2;
}
示例2: getline
int bcnt; // current brace count
/*
* Reads in a line, and eliminates anything in between comments
* or quotes. Also keeps count of the brace level
*/
int getline()
{
LTRACER("getline", 4)
if(!(fin >> curln)) return 0;
cout << curln << endl;
LTRACE(2, curln)
while(curln.m("\".*\"")){ // remove anything in quoted strings
int o, c;
SPString tl= curln.substr(0, o= curln.index("\""));
do{ // make sure the quote is not backslashed
c= curln.index("\"", o+1);
o= c;
}while(c > 1 && curln[c-1] == '\\');
tl += curln.substr(c+1); // rest of line
curln= tl;
// cout << "quote stripped curln= " << curln <<endl;
}
if(curln.m("//")){ // found a comment in line
curln.substr(curln.index("//"))= ""; // chop it off
}
if(curln.m("/\\*")){ // in c comment
SPString tl= curln.substr(0, curln.index("/*"));