本文整理汇总了C++中CStdStringW::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringW::Right方法的具体用法?C++ CStdStringW::Right怎么用?C++ CStdStringW::Right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdStringW
的用法示例。
在下文中一共展示了CStdStringW::Right方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestExtractBodyTextOnly
void TestDocReader::TestExtractBodyTextOnly()
{
DocReader dr;
dr.OpenFile(TEST_REALLY_COMPLEX_DOC);
CStdStringW sDocText = dr.GetMainDocumentText();
assertTest(sDocText.Left(9) == L"Once upon");
assertTest(sDocText.Right(12) == L"ever after.\r");
assertMessage(sDocText.Find(L"Nested") != -1, _T("expected to get the nested table contents, but didnt"));
assertMessage(sDocText.Find(L"Four") != -1, _T("expected to get the table contents, but didnt"));
assertMessage(sDocText.Find(L"a comment") == -1, _T("didnt expect to get the comment contents, but did"));
assertMessage(sDocText.Find(L"header") == -1, _T("didnt expect to get the header contents, but did"));
assertMessage(sDocText.Find(L"footer") == -1, _T("didnt expect to get the footer contents, but did"));
assertMessage(sDocText.Find(L"text box") == -1, _T("didnt expect to get the text box contents, but did"));
assertMessage(sDocText.Find(L"MERGEFORMAT") == -1, _T("didnt expect to get the field code contents, but did"));
assertMessage(sDocText.Find(L"allsorts") != -1, _T("expected to get the field result contents, but didny"));
assertMessage(sDocText.Find(L"be footnote") == -1, _T("didnt expect to get the footnote, but did"));
assertMessage(sDocText.Find(L"Line Break\013") != -1, _T("expected char 11 as line break"));
assertMessage(sDocText.Find(L"Section Break\014") != -1, _T("expected char 12 as section break"));
// assertMessage(sDocText.Find(L"Symbol Char\050") != -1, _T("expected char 40 as symbol char"));
assertMessage(sDocText.Find(L"NonBreakSpace\240char") != -1, _T("expected char 160 as non breaking space"));
//assertMessage(sDocText.Find(L"EnDash\226") != -1, _T("expected char 150 as En dash"));
//assertMessage(sDocText.Find(L"EnDash\227") != -1, _T("expected char 150 as Em dash"));
// assertMessage(sDocText.Find(L"the \025 document") != -1, _T("expected char 21 as field char"));
assertMessage(sDocText.Find(L"One\007Two") != -1, _T("expected char 7 as cell char"));
}
示例2: GetLongPathName
DWORD GetLongPathName (CStdStringW strShortPath, CStdStringW &strLongPath)
{
int iFound = strShortPath.ReverseFind (L'\\');
if (iFound > 1)
{
// recurse to peel off components
//
if (GetLongPathName(strShortPath.Left (iFound), strLongPath) > 0)
{
strLongPath += L'\\';
if (strShortPath.Right(1) != L"\\")
{
HANDLE hFind;
if (g_bIsNT)
{
WIN32_FIND_DATAW findData;
// append the long component name to the path
//
if (INVALID_HANDLE_VALUE != (hFind = ::FindFirstFileW (strShortPath, &findData)))
{
strLongPath += findData.cFileName;
::FindClose (hFind);
}
else
{
// if FindFirstFile fails, return the error code
//
strLongPath.Empty();
return 0;
}
}
else
{
WIN32_FIND_DATAA findData;
// append the long component name to the path
//
if (INVALID_HANDLE_VALUE != (hFind = ::FindFirstFileA (CStdStringA (strShortPath), &findData)))
{
strLongPath += findData.cFileName;
::FindClose (hFind);
}
else
{
// if FindFirstFile fails, return the error code
//
strLongPath.Empty();
return 0;
}
}
}
}
}
else
{
strLongPath = strShortPath;
}
return strLongPath.GetLength();
}