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


C++ CStdStringW::Right方法代码示例

本文整理汇总了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"));

}
开发者ID:killbug2004,项目名称:WSProf,代码行数:32,代码来源:TestDocReader.cpp

示例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();
}
开发者ID:hackshields,项目名称:antivirus,代码行数:64,代码来源:PathFuncs.cpp


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