本文整理汇总了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);
}
示例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();
}
示例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;
}
}
}
示例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.
}
示例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);
}
示例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
}
示例7: Trim
std::string& Trim(std::string& _rString)
{
TrimRight(_rString);
TrimLeft(_rString);
return (_rString);
}
示例8: TrimLeft
/*----------------------------------------------------------------------
| NPT_String::Trim
+---------------------------------------------------------------------*/
void
NPT_String::Trim(char c)
{
char s[2] = {c, 0};
TrimLeft((const char*)s);
TrimRight((const char*)s);
}
示例9: Trim
char* Trim(char* pszSource)
{
if (pszSource == NULL) {
return NULL;
}
return TrimLeft(TrimRight(pszSource));
}
示例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;
}
示例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();
}
示例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;
}
示例13: XIsEmptyString
bool XIsEmptyString( const char* str )
{
CString s(str);
TrimLeft( s );
TrimRight( s );
return ( s.empty() || s == "" );
}
示例14: UncenterButtonImage
//---------------------------------------------------------------------------
void __fastcall UncenterButtonImage(TButton * Button)
{
Button->ImageMargins->Left = 0;
if (UseThemes())
{
Button->Caption = TrimLeft(Button->Caption);
}
}
示例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);
}