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


C++ SimpleString::subString方法代码示例

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


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

示例1: listTestGroupAndCaseNames

void TestRegistry::listTestGroupAndCaseNames(TestResult& result)
{
    SimpleString groupAndNameList;

    for (UtestShell *test = tests_; test != NULL; test = test->getNext()) {
        if (testShouldRun(test, result)) {
            SimpleString groupAndName;
            groupAndName += "#";
            groupAndName += test->getGroup();
            groupAndName += ".";
            groupAndName += test->getName();
            groupAndName += "#";

            if (!groupAndNameList.contains(groupAndName)) {
                groupAndNameList += groupAndName;
                groupAndNameList += " ";
            }
        }
    }

    groupAndNameList.replace("#", "");

    if (groupAndNameList.endsWith(" "))
        groupAndNameList = groupAndNameList.subString(0, groupAndNameList.size() - 1);
    result.print(groupAndNameList.asCharString());
}
开发者ID:13coders,项目名称:cookiecutter-kata-cpputest,代码行数:26,代码来源:TestRegistry.cpp

示例2: HexStringFrom

SimpleString HexStringFrom(signed char value)
{
    SimpleString result = StringFromFormat("%x", value);
    if(value < 0) {
        size_t size = result.size();
        result = result.subString(size-(CPPUTEST_CHAR_BIT/4));
    }
    return result;
}
开发者ID:uecasm,项目名称:cpputest,代码行数:9,代码来源:SimpleString.cpp

示例3: StringFromBinary

SimpleString StringFromBinary(const unsigned char* value, size_t size)
{
    SimpleString result;

    for (size_t i = 0; i < size; i++) {
        result += StringFromFormat("%02X ", value[i]);
    }
    result = result.subString(0, result.size() - 1);

    return result;
}
开发者ID:uecasm,项目名称:cpputest,代码行数:11,代码来源:SimpleString.cpp

示例4: createDifferenceAtPosString

SimpleString TestFailure::createDifferenceAtPosString(const SimpleString& actual, size_t position)
{
	SimpleString result;
	const size_t extraCharactersWindow = 20;
	const size_t halfOfExtraCharactersWindow = extraCharactersWindow / 2;

	SimpleString paddingForPreventingOutOfBounds (" ", halfOfExtraCharactersWindow);
	SimpleString actualString = paddingForPreventingOutOfBounds + actual + paddingForPreventingOutOfBounds;
	SimpleString differentString = StringFromFormat("difference starts at position %lu at: <", (unsigned long) position);

	result += "\n";
	result += StringFromFormat("\t%s%s>\n", differentString.asCharString(), actualString.subString(position, extraCharactersWindow).asCharString());

	SimpleString markString = actualString.subString(position, halfOfExtraCharactersWindow+1);
	markString = removeAllPrintableCharactersFrom(markString);
	markString = addMarkerToString(markString, halfOfExtraCharactersWindow);

	result += StringFromFormat("\t%s%s", SimpleString(" ", differentString.size()).asCharString(), markString.asCharString());
	return result;
}
开发者ID:dreadlock,项目名称:cpputest,代码行数:20,代码来源:TestFailure.cpp


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