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


C++ string::left方法代码示例

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


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

示例1: ILog

void plResponderModifier::ILog(uint32_t color, const char* format, ...)
{
#ifdef STATUS_LOG
    if (!gLog)
        gLog = plStatusLogMgr::GetInstance().CreateStatusLog(15, "Responder", plStatusLog::kFilledBackground | plStatusLog::kDeleteForMe | plStatusLog::kDontWriteFile | plStatusLog::kAlignToTop);

    if (!format || *format == '\0')
        return;

    ST::string keyName = GetKeyName();

    // Make sure this key isn't in our list of keys to deny
    for (const auto& it : gNoLogStrings) {
        if (keyName.starts_with(it))
            return;
    }

    // Format the log text
    char buf[256];
    va_list args;
    va_start(args, format);
    int numWritten = hsVsnprintf(buf, sizeof(buf), format, args);
    hsAssert(numWritten > 0, "Buffer too small");
    va_end(args);

    // Strip the redundant part off the key name
    ST_ssize_t modPos = keyName.find("_ResponderModifier");
    if (modPos != -1)
        keyName = keyName.left(modPos);

    ST::string logLine = ST::format("{}: {}", keyName, buf);
    gLog->AddLine(logLine.c_str(), color);
#endif // STATUS_LOG
}
开发者ID:H-uru,项目名称:Plasma,代码行数:34,代码来源:plResponderModifier.cpp

示例2: cdUp

ST::string cdUp(ST::string path) {
    // Check for root paths, we can't go up from there!
#ifdef _WIN32
    if (path.substr(1) == ":\\")
        return path;
#else
    if (path == "/")
        return path;
#endif

    // Not very robust, but it works for one level of parent scanning
    if (path.is_empty())
        return ".." PATHSEPSTR;

    // Strip the ending slash, if necessary, and then go up one dir
    if (path.char_at(path.size()-1) == PATHSEP)
        path = path.left(path.size() - 1);
    ST::string up = path.before_last(PATHSEP);
    if (path.char_at(0) == PATHSEP) {
        // Absolute path specified -- make sure we keep it that way
        return up + PATHSEPSTR;
    } else {
        // Relative path specified
        return up.is_empty() ? "" : up + PATHSEPSTR;
    }
}
开发者ID:Lunanne,项目名称:libhsplasma,代码行数:26,代码来源:PlasmaSum.cpp

示例3: getOutputDir

ST::string getOutputDir(const ST::string& filename, plPageInfo* page) {
    ST::string odir = filename;
    ST_ssize_t sepLoc = odir.find_last(PATHSEP);
    if (sepLoc < 0)
        odir = ST::string();
    else
        odir = odir.left(sepLoc + 1);
    return odir + ST::format("{}_{}_PRP" PATHSEPSTR, page->getAge(), page->getPage());
}
开发者ID:Deledrius,项目名称:libhsplasma,代码行数:9,代码来源:PrpPack.cpp


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