don't make a copy of the string when comparing
This commit is contained in:
@@ -664,19 +664,15 @@ void StripCrnl(CString &s)
|
|||||||
bool BeginsWith( const CString &sTestThis, const CString &sBeginning )
|
bool BeginsWith( const CString &sTestThis, const CString &sBeginning )
|
||||||
{
|
{
|
||||||
ASSERT( !sBeginning.empty() );
|
ASSERT( !sBeginning.empty() );
|
||||||
|
return sTestThis.compare( 0, sBeginning.length(), sBeginning ) == 0;
|
||||||
if( sTestThis.size() < sBeginning.size() )
|
|
||||||
return false;
|
|
||||||
return sTestThis.Left( sBeginning.size() ) == sBeginning;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EndsWith( const CString &sTestThis, const CString &sEnding )
|
bool EndsWith( const CString &sTestThis, const CString &sEnding )
|
||||||
{
|
{
|
||||||
ASSERT( !sEnding.empty() );
|
ASSERT( !sEnding.empty() );
|
||||||
|
|
||||||
if( sTestThis.size() < sEnding.size() )
|
if( sTestThis.size() < sEnding.size() )
|
||||||
return false;
|
return false;
|
||||||
return sTestThis.Right( sEnding.size() ) == sEnding;
|
return sTestThis.compare( sTestThis.length()-sEnding.length(), sEnding.length(), sEnding ) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StripCvs( vector<CString> &vs )
|
void StripCvs( vector<CString> &vs )
|
||||||
|
|||||||
Reference in New Issue
Block a user