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


C++ wstring::find_last_not_of方法代码示例

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


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

示例1: ltrim

void StringUtil::ltrim(std::wstring& str) {
	if (str.empty())
		return;

	std::wstring::size_type pos = str.find_last_not_of(L" ");
	if (pos != std::wstring::npos)
		str.erase(pos+1);

	pos = str.find_last_not_of(L"\t");
	if (pos != std::wstring::npos)
		str.erase(pos+1);
}
开发者ID:gvsurenderreddy,项目名称:openulteo,代码行数:12,代码来源:StringUtil.cpp

示例2:

std::wstring 
stringHelper::rtrim( const std::wstring& wstr )
{
	if ( wstr.empty() ) return wstr ;

	return wstr.substr( 0, wstr.find_last_not_of( __delimiters ) + 1 ) ;
}
开发者ID:casaletto,项目名称:alby.assemblyShellExtension,代码行数:7,代码来源:stringHelper.cpp

示例3: wbasename

static std::wstring wbasename(const std::wstring &s) {
    const auto i = s.find_last_not_of(L"/");
    if (i == std::wstring::npos) {
        return s.empty() ? L"." : L"/";
    }
    const auto from = 1 + s.find_last_of(L"/", i); /* 1 + std::wstring::npos == 0 */
    return s.substr(from, i - from + 1);
}
开发者ID:shdown,项目名称:anitomy-cli,代码行数:8,代码来源:anitomy-cli.cpp

示例4: STLTrimRight

/* 
 * Trim chTarget from the right of string s.
 */
void StringUtils::STLTrimRight(std::wstring& s, wchar_t chTarget)
{
	std::wstring::size_type n = s.find_last_not_of( chTarget );
	if( n == std::wstring::npos )
		s.clear();
	else
		s = s.substr( 0, n+1 );
}
开发者ID:HenrikBengtsson,项目名称:Affx-Fusion-SDK,代码行数:11,代码来源:StringUtils.cpp

示例5: trimTrailingSpaces

std::wstring UeiArgsParser::trimTrailingSpaces(std::wstring& aString, const std::wstring& aWhitespaces)
{
    size_t trailingSpace = aString.find_last_not_of(aWhitespaces);
    if (trailingSpace != std::wstring::npos)
    {
        aString.erase(trailingSpace + 1);
    }
    return aString;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:9,代码来源:ueiargsparser.cpp

示例6: rtrim

void rtrim( std::wstring &s )
{
	std::wstring::size_type	pos( s.find_last_not_of( L" \t" ) );
	if( pos != std::wstring::npos ) {
		s.resize( pos+1 );
	} else {
		s.clear();
	}
}
开发者ID:compihu,项目名称:pnamenu,代码行数:9,代码来源:utility.cpp

示例7: wtrim

void TestUtils::wtrim(std::wstring& str, const wchar_t* szTrim)
{
    std::string::size_type pos = str.find_last_not_of(szTrim);
    if(pos != std::string::npos) {
        str.erase(pos + 1);
        pos = str.find_first_not_of(szTrim);
        if(pos != std::string::npos) str.erase(0, pos);
    }
    else str.erase(str.begin(), str.end());
}
开发者ID:doo,项目名称:CrashRpt,代码行数:10,代码来源:TestUtils.cpp

示例8: trims

bool trims(const std::wstring& str, std::vector <std::wstring>& vcResult, char c)
{
    size_t fst = str.find_first_not_of( c );
    size_t lst = str.find_last_not_of( c );

    if( fst != std::wstring::npos )
        vcResult.push_back(str.substr(fst, lst - fst + 1));

    return true;
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:10,代码来源:trashonekey.cpp

示例9: VerifyGroup

std::wstring Group::VerifyGroup(const std::wstring& str) const
{
	std::wstring strTmp;

	std::wstring::size_type pos = str.find_first_not_of(L" \t\r\n");
	if (pos != std::wstring::npos)
	{
		// Trim white-space
		strTmp.assign(str, pos, str.find_last_not_of(L" \t\r\n") - pos + 1);

		CreateGroup(strTmp);
	}

	return strTmp;
}
开发者ID:chibicitiberiu,项目名称:rainmeter-studio,代码行数:15,代码来源:Group.cpp

示例10: CreateGroup

std::wstring CGroup::CreateGroup(const std::wstring& str)
{
	std::wstring strTmp;

	std::wstring::size_type pos = str.find_first_not_of(L" \t\r\n");
	if (pos != std::wstring::npos)
	{
		// Trim white-space
		strTmp.assign(str, pos, str.find_last_not_of(L" \t\r\n") - pos + 1);

		_wcsupr(&strTmp[0]);
	}

	return strTmp;
}
开发者ID:VladimirKhomenko,项目名称:SunMeter,代码行数:15,代码来源:Group.cpp

示例11: trim

// trim whitespace in front and back of string
void trim(std::wstring& value)
{
    const wchar_t* whitespace = L"\n\r\t";
    size_t startpos = value.find_first_not_of(whitespace);
    if (std::wstring::npos != startpos)
    {
        value = value.substr(startpos);
    }

    size_t endpos = value.find_last_not_of(whitespace);
    if (std::wstring::npos != endpos)
    {
        value = value.substr(0, endpos + 1);
    }
}
开发者ID:Microsoft,项目名称:DesktopBridgeToUWP-Samples,代码行数:16,代码来源:launcher.cpp

示例12: Init

			DWORD Init()
			{
				Registry reg;
				auto result = reg.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", Registry::Mode::Read);
				if (result != ERROR_SUCCESS)
				{
					return result;
				}
				reg.TryReadString(L"CurrentBuildNumber", CurrentBuildNumber);
				reg.TryReadDword(L"CurrentMajorVersionNumber", CurrentMajorVersionNumber);
				reg.TryReadDword(L"CurrentMinorVersionNumber", CurrentMinorVersionNumber);	
                reg.TryReadString(L"CSDbuildNumber", CSDBuildNumber);
                reg.TryReadString(L"CSDVersion", ServicePack);
                auto pos = ServicePack.find_last_not_of(L"Service Pack ");
                if (pos != std::wstring::npos)
                {
                    ServicePack = L"SP" + ServicePack.substr(pos);
                }
                if (reg.TryReadString(L"BuildLabEx", BuildLabEx) != NO_ERROR)
                {
                    reg.TryReadString(L"BuildLab", BuildLabEx);
                }
				reg.TryReadString(L"CurrentVersion", CurrentVersion);
				reg.TryReadString(L"EditionId", EditionId);
				reg.TryReadString(L"ProductName", ProductName);
				if (CurrentMajorVersionNumber > 0)
				{
					CurrentVersion = std::to_wstring(CurrentMajorVersionNumber) + L"." + std::to_wstring(CurrentMinorVersionNumber);
				}
				else
				{
					reg.TryReadString(L"CurrentVersion", CurrentVersion);
				}

				Architecture = IsX64() ? std::wstring(L"x64") : std::wstring(L"x86");
				Language = GetDefaultLocaleName();

				return ERROR_SUCCESS;
			}
开发者ID:fmuecke,项目名称:WinApiHelper,代码行数:39,代码来源:System.hpp

示例13: StrToFieldtype

FIELDTYPE StrToFieldtype(std::wstring string) {
    string.erase(string.find_last_not_of(L" \n\r\t")+1);
    if(string == L"b") {
        return FT_BYTE;
    }
    else if(string == L"s") {
        return FT_WORD;
    }
    else if(string == L"w") {
        return FT_WORD;
    }
    else if(string == L"dw") {
        return FT_DWORD;
    }
    else if(string == L"f") {
        return FT_FLOAT;
    }
    else if(string == L"df") {
        return FT_DFLOAT;
    }
    return FT_BYTE;
}
开发者ID:Wohlhabend-Networks,项目名称:LunaDLL,代码行数:22,代码来源:MiscFuncs.cpp

示例14: TrimRight

std::wstring StringUtilities::TrimRight(const std::wstring& input) {
    size_t endpos = input.find_last_not_of(WIDE_WHITESPACE);
    return (endpos == std::wstring::npos) ? L"" : input.substr(0, endpos + 1);
}
开发者ID:joshmgrant,项目名称:selenium,代码行数:4,代码来源:StringUtilities.cpp

示例15: Trim

static void Trim( std::wstring& str , const std::wstring& chars = L" \t" )
{
    str.erase(str.find_last_not_of(chars)+1);
    str.erase(0, str.find_first_not_of(chars));
}
开发者ID:lidongqiang,项目名称:wvpctool,代码行数:5,代码来源:ado2.cpp


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