本文整理汇总了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());
}
示例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;
}
示例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;
}
示例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;
}