当前位置: 首页>>代码示例>>C++>>正文


C++ STRING::find_last_of方法代码示例

本文整理汇总了C++中STRING::find_last_of方法的典型用法代码示例。如果您正苦于以下问题:C++ STRING::find_last_of方法的具体用法?C++ STRING::find_last_of怎么用?C++ STRING::find_last_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在STRING的用法示例。


在下文中一共展示了STRING::find_last_of方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FileName

// Get file name from path
STRING Port::FileName(STRING file)
{
#ifdef WIN32
#ifdef UNICODE
	int pos = file.find_last_of(L"\\") + 1;
#else
	int pos = file.find_last_of("\\") + 1;
#endif
#elif defined(UNIX)
#ifdef UNICODE
	int pos = file.find_last_of(L"/") + 1;
#else
	int pos = file.find_last_of("/") + 1;
#endif
#endif
	return file.substr(pos);
}
开发者ID:McTwist,项目名称:PixelMap,代码行数:18,代码来源:Utility.cpp

示例2: GenerateDefinitions

void MgWmsLayerDefinitions::GenerateDefinitions(MgUtilDictionary& Dictionary)
{
    MgXmlSynchronizeOnElement ResourceDocument(*m_xmlParser,_("ResourceDocument"));
    if(!ResourceDocument.AtBegin())
        return; // Something is wrong.  We leave.

    while(!ResourceDocument.AtEnd()) {
        STRING sValue; // basic_string
        if(GetElementContents(_("ResourceId"),sValue)) {
            // Okay, the ResourceId is too decorated for our purposes;
            // the outside world doesn't need to know (and clutter up
            // URL command lines with) this syntactic "punctuation" so
            // we just get rid of it.
            // Remove the Library prefix, if present.
            if(sValue.find(_("Library://")) == 0)
                sValue = sValue.substr(10);
            // Remove the LayerDefinition suffix, if present.
            STRING::size_type iEnd = sValue.find(_(".LayerDefinition"));
            if(iEnd != STRING::npos)
                sValue.resize(iEnd);
            // There, that's our Layer Name.
            Dictionary.AddDefinition(_("Layer.Name"),sValue);

            // Until we have "Friendly Name" support, the
            // friendly name will simply be the layer name sans
            // path.
            iEnd = sValue.find_last_of('/');
            if(iEnd != STRING::npos)
                sValue = sValue.substr(iEnd+1); // one past the slash.

            // That's our Layer Title,
            // Note that subsequently-found metadata may override this
            // definition with a real title... one that the user actually
            // wants.  This just provides a default in case no such
            // friendly name exists.... that keeps the list of layer names
            // from being a list of empty strings.
            Dictionary.AddDefinition(_("Layer.Title"),sValue);
        }
        else if(!GetMetadataDefinitions(Dictionary)) {
          SkipElement(NULL);
        }
    }

}
开发者ID:kanbang,项目名称:Colt,代码行数:44,代码来源:WmsLayerDefinitions.cpp

示例3: removePath

// Remove the path from a file name.
STRING removePath(const STRING str)
{
	return str.substr(str.find_last_of(_T('\\')) + 1);
}
开发者ID:LameAss-Studio,项目名称:trans3,代码行数:5,代码来源:paths.cpp


注:本文中的STRING::find_last_of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。