示例#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
t_Str CDataFile::CommentStr(t_Str szComment)
{
   t_Str szNewStr = t_Str("");

   Trim(szComment);

   if ( szComment.size() == 0 )
      return szComment;

   if ( szComment.find_first_of(CommentIndicators) != 0 )
      {
         szNewStr = CommentIndicators[0];
         szNewStr += " ";
      }

   szNewStr += szComment;

   return szNewStr;
}