コード例 #1
0
// GetNextWord
// Given a key +delimiter+ value string, pulls the key name from the string,
// deletes the delimiter and alters the original string to contain the
// remainder.  Returns the key
t_Str GetNextWord(t_Str& CommandLine)
{
   int nPos = CommandLine.find_first_of(EqualIndicators);
   t_Str sWord = t_Str("");

   if ( nPos > -1 )
      {
         sWord = CommandLine.substr(0, nPos);
         CommandLine.erase(0, nPos+1);
      }
   else
      {
         sWord = CommandLine;
         CommandLine = t_Str("");
      }

   Trim(sWord);
   return sWord;
}
コード例 #2
0
ファイル: CDataFile.cpp プロジェクト: cubemoon/game-editor
// GetNextWord
// Given a key +delimiter+ value string, pulls the key name from the string,
// deletes the delimiter and alters the original string to contain the
// remainder.  Returns the key
t_Str GetNextWord(t_Str& CommandLine)
{
	int nPos = CommandLine.find(EqualIndicators[0]);

	if(nPos == gedString::npos)
		nPos = CommandLine.find(EqualIndicators[1]);

	t_Str sWord = t_Str("");

	if ( nPos > -1 )
	{
		sWord = CommandLine.substr(0, nPos);
		CommandLine.erase(0, nPos+1);
	}
	else
	{
		sWord = CommandLine;
		CommandLine = t_Str("");
	}

	Trim(sWord);
	return sWord;
}