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


C++ tstring::substr方法代码示例

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


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

示例1:

CTokenizer::CTokenizer(const tstring& p_Str, const tstring& p_Delimiters)
{
	const tstring::size_type len = p_Str.length();
	tstring::size_type i = 0;

	while(i < len)
	{
		// eat leading whitespace
		i = p_Str.find_first_not_of(p_Delimiters, i);
		if(i == tstring::npos)
			return;   // nothing left but white space

		// find the end of the token
		tstring::size_type j = p_Str.find_first_of(p_Delimiters, i);

		// push token
		if(j == tstring::npos) 
		{
			m_Tokens.push_back(p_Str.substr(i));
			return;
		} else
			m_Tokens.push_back(p_Str.substr(i, j - i));

		// set up for next loop
		i = j + 1;
	}
}
开发者ID:Ocerus,项目名称:Ocerus,代码行数:27,代码来源:Utils.cpp

示例2: RegPathToHkeyAndSubKey

BOOL CRegistryTool::RegPathToHkeyAndSubKey(tstring regPath,HKEY *hKey,tstring *strSubKey)
{
	int iPos;
	tstring strRootKey;
	BOOL bResult = FALSE;

	if(regPath.size()==0)
		return FALSE;

	iPos = regPath.find("\\");

	if(iPos == tstring::npos)
		return FALSE;

	strRootKey = regPath.substr(0,iPos);
	if(strRootKey.size()==0)
		return FALSE;

	if(StringToRootKey(strRootKey,hKey))
		bResult = TRUE;

	*strSubKey = regPath.substr(iPos+1,regPath.size()-iPos-1);
	

	return bResult;
}
开发者ID:louk78,项目名称:GetSystemInfo,代码行数:26,代码来源:registrytool.cpp

示例3: dotCounter

	Filepath::Filepath(const tstring & full_path)
		: m_Path(EMPTY_STRING)
		, m_File(EMPTY_STRING)
	{
		int32 dotCounter(0);
		for(uint32 i = 0; i < full_path.size(); ++i)
		{
			if(full_path[i] == _T('.'))
			{
				++dotCounter;
			}
		}
		if(dotCounter > 1)
		{
			Logger::GetInstance()->Log(LogLevel::Error, 
				_T("Please don't use . in your filename (except for the file extension)"));
		}

		auto index = full_path.find_last_of('/');
		if(index == tstring::npos)
		{
			index = full_path.find_last_of('\\');
		}
		if(index != tstring::npos)
		{
			index += 1;
			m_Path = full_path.substr(0,index);
			m_File = full_path.substr(index, full_path.length() - index);
		}
		else
		{
			m_File = full_path;
		}
	}
开发者ID:AzureCrab,项目名称:StarEngine,代码行数:34,代码来源:Filepath.cpp

示例4:

CRegStdBase::CRegStdBase (const tstring& key, bool force, HKEY base, REGSAM sam)
    : CRegBaseCommon<tstring> (key, force, base, sam)
{
    tstring::size_type pos = key.find_last_of(_T('\\'));
    m_path = key.substr(0, pos);
    m_key = key.substr(pos + 1);
}
开发者ID:fabgithub,项目名称:TortoiseGit,代码行数:7,代码来源:Registry.cpp

示例5: hkSession

RegWrap::RegWrap( const tstring& sKey, REGSAM samDesired ) :
    hkSession( 0 )
{
    // Parse the key

    unsigned long iFirstSlash = sKey.find_first_of( _T("\\") );

    if ( iFirstSlash == tstring::npos )
        return;

    tstring sRootKey = sKey.substr( 0, iFirstSlash );
    tstring sSubKey = sKey.substr( iFirstSlash+1 );

    // Get the root key by its name

    HKEY hRootKey = (HKEY)-1;

    for ( unsigned long i = 0; rkam[i].szName != 0; ++i )
        if ( sRootKey == rkam[i].szName )
            hRootKey = rkam[i].hRootKey;

    if ( hRootKey == (HKEY)-1 )
        return;

    Init( hRootKey, sSubKey, samDesired );
}
开发者ID:mspline,项目名称:farvcs,代码行数:26,代码来源:regwrap.cpp

示例6: ParseLink

bool CDDELink::ParseLink(const tstring& link, tstring& service, tstring& topic, tstring& item)
{
	size_t serviceBegin = 0;
	size_t serviceEnd = link.find_first_of('|', serviceBegin);

	if ( (serviceEnd == tstring::npos) || (serviceEnd == serviceBegin) )
		return false;

	size_t topicBegin = serviceEnd + 1;
	size_t topicEnd = link.find_first_of('!', topicBegin);

	if ( (topicEnd == tstring::npos) || (topicEnd == topicBegin) )
		return false;

	size_t itemBegin = topicEnd + 1;
	size_t itemEnd = link.length();

	if (itemEnd == itemBegin)
		return false;

	service = link.substr(serviceBegin, serviceEnd - serviceBegin);
	topic   = link.substr(topicBegin,   topicEnd   - topicBegin);
	item    = link.substr(itemBegin,    itemEnd    - itemBegin);

	ASSERT(service.length() != 0);
	ASSERT(topic.length() != 0);
	ASSERT(item.length() != 0);

	return true;
}
开发者ID:chrisoldwood,项目名称:NCL,代码行数:30,代码来源:DDELink.cpp

示例7: ConvertTString

	D3DXVECTOR2 ConvertTString(const tstring & value)
	{
        D3DXVECTOR2 vec;
        int index = value.find(';',0);
		vec.x = ConvertTString<float>(value.substr(0, index));
		vec.y = ConvertTString<float>(value.substr(++index,value.size()-index));
        return vec;
	}
开发者ID:GlenDC,项目名称:Lemmings3D,代码行数:8,代码来源:XMLConverter.cpp

示例8:

	uvec2 string_cast<uvec2, tstring>
		(const tstring & value)
	{
		uvec2 vec;
		int32 index = value.find(';', 0);
		vec.x = string_cast<uint32>(value.substr(0, index));
		vec.y = string_cast<uint32>(value.substr(++index, value.size() - index));
		return vec;
	}
开发者ID:AzureCrab,项目名称:StarEngine,代码行数:9,代码来源:Helpers.cpp

示例9: lay

	pos string_cast<pos, tstring>
		(const tstring & value)
	{
		pos pos;
		int32 index = value.find(';', 0);
		pos.x = string_cast<float32>(value.substr(0, index));
		int32 index2 = value.find(';', ++index);
		pos.y = string_cast<float32>(value.substr(index, index2 - index));
		pos.l = lay(string_cast<int32>(value.substr(++index2, value.size() - index2)));
		return pos;
	}
开发者ID:AzureCrab,项目名称:StarEngine,代码行数:11,代码来源:Helpers.cpp

示例10: isPathValid

bool isPathValid(const tstring &sPath) noexcept {
	if (sPath.empty())
		return false;

	if ((sPath.substr(1, 2) == _T(":\\")) || (sPath.substr(0, 2) == _T("\\\\"))) {
		if (GetFileAttributes(sPath.c_str()) & FILE_ATTRIBUTE_DIRECTORY)
			return true;
	}

	return false;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例11: ShowMC

void PopupManager::ShowMC(const tstring& msg, HWND owner){
	int pos1 = msg.find_first_of(_T("<"));
	int pos2 = msg.find_first_of(_T(">"));
	
	//something wrong with the string, return
	if(pos1 == tstring::npos || pos2 == tstring::npos)
		return;

	ShowMC(msg.substr(pos1+1, pos2-pos1-1), msg.substr(pos2+1), owner);
	
}
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:11,代码来源:PopupManager.cpp

示例12: dcassert

ChatCommandContext::ChatCommandContext(const tstring& s) {
  dcassert(isCommand(s));
  const string::size_type i = s.find(' ');
  if (i != string::npos) {
    param = s.substr(i + 1);
    command = s.substr(1, i - 1);
  } 
  else {
    command = s.substr(1);
  }
}
开发者ID:inetra,项目名称:peers1,代码行数:11,代码来源:ChatCommand.cpp

示例13: GetFilePath

tstring GetFilePath(tstring FileName){
	tstring::size_type n = FileName.find_last_of(_T('\\'));
	if(n != tstring::npos){
		return FileName.substr(0,n);
	}
	n = FileName.find_last_of(_T('/'));
	if(n == tstring::npos){
		return FileName;
	}
	return FileName.substr(0,n);
};
开发者ID:GMIS,项目名称:GMIS,代码行数:11,代码来源:Space.cpp

示例14: GetFileNoPathName

tstring GetFileNoPathName(tstring s)
{
	tstring::size_type n = s.find_last_of(_T('\\'));
	if(n != tstring::npos){
		return s.substr(n+1);
	}
	n = s.find_last_of(_T('/'));
	if(n == tstring::npos){
		return s;
	}
	return s.substr(n);
}
开发者ID:GMIS,项目名称:GMIS,代码行数:12,代码来源:Space.cpp

示例15: matches

static bool matches(tstring const& mask, tstring const& str)
{
    if( mask == str )
        return true;
    if( mask.size() > 0 && mask[mask.size()-1] == '*') {
        size_t const_part_len = mask.size()-1;
        
        if( str.size() >= const_part_len &&
            str.substr(0,const_part_len) == mask.substr(0, const_part_len) )
            return true;
    }
    return false;
}
开发者ID:zbigg,项目名称:tinfra,代码行数:13,代码来源:trace.cpp


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