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


C++ TrimLeft函数代码示例

本文整理汇总了C++中TrimLeft函数的典型用法代码示例。如果您正苦于以下问题:C++ TrimLeft函数的具体用法?C++ TrimLeft怎么用?C++ TrimLeft使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ScrSys_LoadPreferences

void ScrSys_LoadPreferences()
{
FILE *fl = fopen(pref_FileName,"rb");
if (fl == NULL)
    return;

char buffer[128];
char *str;

while(!feof(fl))
{
    fgets(buffer,128,fl);
    str=TrimLeft(TrimRight(buffer));
    if (str != NULL)
    if (strlen(str)>0)
        for (int16_t i=0; i<pref_COUNT; i++ )
            if (strCMP(str,prefs[i].name)==0)
            {
                str=strstr(str,"=");
                if (str != NULL)
                {
                    str++;
                    str=TrimLeft(str);
                    SetDirectgVarInt(prefs[i].slot,atoi(str));
                }
                break;
            }
};

fclose(fl);
}
开发者ID:CasperGemini,项目名称:Zengine,代码行数:31,代码来源:ScriptSystem.cpp

示例2: TrimLeft

void SMLoader::LoadFromSMTokens( 
	CString sStepsType, 
	CString sDescription,
	CString sDifficulty,
	CString sMeter,
	CString sRadarValues,
	CString sNoteData,
	CString sAttackData,
	Steps &out
)
{
	TrimLeft(sStepsType); 
	TrimRight(sStepsType); 
	TrimLeft(sDescription); 
	TrimRight(sDescription); 
	TrimLeft(sDifficulty); 
	TrimRight(sDifficulty); 


//	LOG->Trace( "Steps::LoadFromSMTokens()" );

	out.m_StepsType = GameManager::StringToStepsType(sStepsType);
	out.SetDescription(sDescription);
	out.SetDifficulty(StringToDifficulty( sDifficulty ));

	// HACK:  We used to store SMANIAC as DIFFICULTY_HARD with special description.
	// Now, it has its own DIFFICULTY_CHALLENGE
	if( sDescription.CompareNoCase("smaniac") == 0 ) 
		out.SetDifficulty( DIFFICULTY_CHALLENGE );
	// HACK:  We used to store CHALLENGE as DIFFICULTY_HARD with special description.
	// Now, it has its own DIFFICULTY_CHALLENGE
	if( sDescription.CompareNoCase("challenge") == 0 ) 
		out.SetDifficulty( DIFFICULTY_CHALLENGE );

	out.SetMeter(atoi(sMeter));
	CStringArray saValues;
	split( sRadarValues, ",", saValues, true );
	if( saValues.size() == NUM_RADAR_CATEGORIES )
	{
		RadarValues v;
		FOREACH_RadarCategory(rc)
			v[rc] = strtof( saValues[rc], NULL );
		out.SetRadarValues( v ); 
	}
    
	out.SetSMNoteData(sNoteData, sAttackData);

	out.TidyUpData();
}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:49,代码来源:NotesLoaderSM.cpp

示例3: while

/* "path(mangled name+offset) [address]" */
void BacktraceNames::FromString( CString s )
{
    /* Hacky parser.  I don't want to use regexes in the crash handler. */
    CString MangledAndOffset, sAddress;
    unsigned pos = 0;
    while( pos < s.size() && s[pos] != '(' && s[pos] != '[' )
        File += s[pos++];
    TrimRight( File );
    TrimLeft( File );

    if( pos < s.size() && s[pos] == '(' )
    {
        pos++;
        while( pos < s.size() && s[pos] != ')' )
            MangledAndOffset += s[pos++];
    }

    if( MangledAndOffset != "" )
    {
        size_t plus = MangledAndOffset.rfind('+');

        if(plus == MangledAndOffset.npos)
        {
            Symbol = MangledAndOffset;
            Offset = 0;
        }
        else
        {
            Symbol = MangledAndOffset.substr(0, plus);
            CString str = MangledAndOffset.substr(plus);
            if( sscanf(str, "%i", &Offset) != 1 )
                Offset=0;
        }
    }
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:36,代码来源:BacktraceNames.cpp

示例4: split

void ActiveAttackList::Refresh()
{
	CString s;

	const AttackArray& attacks = GAMESTATE->m_ActiveAttacks[m_PlayerNumber];	// NUM_INVENTORY_SLOTS
	
	// clear all lines, then add all active attacks
	for( unsigned i=0; i<attacks.size(); i++ )
	{
		if( !attacks[i].bOn )
			continue; /* hasn't started yet */

		CStringArray asMods;
		split( attacks[i].sModifier, ",", asMods );
		for( unsigned j=0; j<asMods.size(); j++ )
		{
			CString& sMod = asMods[j];
			TrimLeft( sMod );
			TrimRight( sMod );

			sMod = PlayerOptions::ThemeMod( sMod );

			if( s.empty() )
				s = sMod;
			else
				s = sMod + "\n" + s;
		}
	}

	this->SetText( s );	// BitmapText will not rebuild vertices if these strings are the same.
}
开发者ID:Fighter19,项目名称:PSPMania,代码行数:31,代码来源:ActiveAttackList.cpp

示例5: TrimLeft

/*----------------------------------------------------------------------
|   NPT_String::Trim
+---------------------------------------------------------------------*/
const NPT_String& 
NPT_String::Trim(char c)
{
    char s[2] = {c, 0};
    TrimLeft((const char*)s);
    return TrimRight((const char*)s);
}
开发者ID:axiomatic-systems,项目名称:Neptune,代码行数:10,代码来源:NptStrings.cpp

示例6: import_label

static TCHAR *
import_label(const char *src)
{
  if (src == nullptr)
    return nullptr;

  src = TrimLeft(src);
  if (strcmp(src, "RAILWAY STATION") == 0 ||
      strcmp(src, "RAILROAD STATION") == 0 ||
      strcmp(src, "UNK") == 0)
    return nullptr;

#ifdef _UNICODE
  size_t length = strlen(src);
  TCHAR *dest = new TCHAR[length + 1];
  if (::MultiByteToWideChar(CP_UTF8, 0, src, -1, dest, length + 1) <= 0) {
    delete[] dest;
    return nullptr;
  }

  return dest;
#else
  if (!ValidateUTF8(src))
    return nullptr;

  return strdup(src);
#endif
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:28,代码来源:XShape.cpp

示例7: Trim

	std::string& Trim(std::string& _rString)
	{
		TrimRight(_rString);
		TrimLeft(_rString);

		return (_rString);
	}
开发者ID:bullfrognz,项目名称:PikPok,代码行数:7,代码来源:StrUtilities.cpp

示例8: TrimLeft

/*----------------------------------------------------------------------
|   NPT_String::Trim
+---------------------------------------------------------------------*/
void 
NPT_String::Trim(char c)
{
    char s[2] = {c, 0};
    TrimLeft((const char*)s);
    TrimRight((const char*)s);
}
开发者ID:AWilco,项目名称:xbmc,代码行数:10,代码来源:NptStrings.cpp

示例9: Trim

char* Trim(char* pszSource)
{
	if (pszSource == NULL) {
		return NULL;
	}
	return TrimLeft(TrimRight(pszSource));
}
开发者ID:k2b3d,项目名称:authsrc,代码行数:7,代码来源:Util.c

示例10: GetAdditionalLog

RageLog::~RageLog()
{
	/* Add the mapped log data to info.txt. */
	const CString AdditionalLog = GetAdditionalLog();
	vector<CString> AdditionalLogLines;
	split( AdditionalLog, "\n", AdditionalLogLines );
	for( unsigned i = 0; i < AdditionalLogLines.size(); ++i )
	{
		TrimLeft( AdditionalLogLines[i] );
		TrimRight( AdditionalLogLines[i] );
		this->Info( "%s", AdditionalLogLines[i].c_str() );
	}

	Flush();
	SetShowLogOutput( false );
	g_fileLog->Close();
	g_fileInfo->Close();

	delete g_Mutex;
	g_Mutex = NULL;

	delete g_fileLog;
	g_fileLog = NULL;
	delete g_fileInfo;
	g_fileInfo = NULL;
}
开发者ID:vb-mich,项目名称:openitg,代码行数:26,代码来源:RageLog.cpp

示例11: TrimLeft

//---------------------------------------------------------------------------
void TFileMasks::TrimEx(UnicodeString & Str, intptr_t & Start, intptr_t & End)
{
  UnicodeString Buf = TrimLeft(Str);
  Start += Str.Length() - Buf.Length();
  Str = TrimRight(Buf);
  End -= Buf.Length() - Str.Length();
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:8,代码来源:FileMasks.cpp

示例12: TrimLeft

int  CFunc::TrimAll(char *Src)
{
	char *Pt;
	char *pHead = Src;
	TrimLeft(Src);//去除Src左边与右边的空格
	TrimRight(Src);
	
    if((Pt=pHead=strstr(Src," "))==0)
		return 1;
	while(*pHead != '\x0a')
	{
		while ( *pHead == ' ' && *pHead != '\0')
		{
			pHead ++ ;
		}
		while (*pHead != '\0'  && *pHead != ' '&& *pHead!='\x0a')
		{
			*Pt = *pHead ;
			Pt++ ;
			pHead++ ;
		}
		*Pt = '\0' ;
	}
	if((Pt=strstr(Src,";"))!=0)  //去处Src中的注释
	{
		*Pt='\0';
	}
	return 1;
}
开发者ID:xueyedamo,项目名称:EJ-Log-Annalysis-Tool,代码行数:29,代码来源:func.cpp

示例13: XIsEmptyString

bool XIsEmptyString( const char* str )
{
	CString s(str);
	TrimLeft( s );
	TrimRight( s );

	return ( s.empty() || s == "" );
}
开发者ID:Braunson,项目名称:openitg,代码行数:8,代码来源:XmlFile.cpp

示例14: UncenterButtonImage

//---------------------------------------------------------------------------
void __fastcall UncenterButtonImage(TButton * Button)
{
  Button->ImageMargins->Left = 0;
  if (UseThemes())
  {
    Button->Caption = TrimLeft(Button->Caption);
  }
}
开发者ID:mpmartin8080,项目名称:winscp,代码行数:9,代码来源:WinInterface.cpp

示例15: MultiByteToWideChar

void CUnicodeString::TrimLeft(CHAR chTarget)
{
	CHAR c[] = "\0\0";
	c[0] = chTarget;
	WCHAR wc[] = L"\0\0";;
	MultiByteToWideChar(CP_ACP, 0, c, 1, wc, 1);
	TrimLeft(wc);
}
开发者ID:MaChao5,项目名称:pdfviewer-win32,代码行数:8,代码来源:UnicodeString.cpp


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