add BeginsWith
This commit is contained in:
@@ -661,6 +661,15 @@ void StripCrnl(CString &s)
|
|||||||
s.erase(s.size()-1);
|
s.erase(s.size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BeginsWith( const CString &sTestThis, const CString &sBeginning )
|
||||||
|
{
|
||||||
|
ASSERT( !sBeginning.empty() );
|
||||||
|
|
||||||
|
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() );
|
||||||
|
|||||||
@@ -326,6 +326,7 @@ inline T Decrement( T a ) { --a; return a; }
|
|||||||
void TrimLeft(CString &str, const char *s = "\r\n\t ");
|
void TrimLeft(CString &str, const char *s = "\r\n\t ");
|
||||||
void TrimRight(CString &str, const char *s = "\r\n\t ");
|
void TrimRight(CString &str, const char *s = "\r\n\t ");
|
||||||
void StripCrnl(CString &s);
|
void StripCrnl(CString &s);
|
||||||
|
bool BeginsWith( const CString &sTestThis, const CString &sBeginning );
|
||||||
bool EndsWith( const CString &sTestThis, const CString &sEnding );
|
bool EndsWith( const CString &sTestThis, const CString &sEnding );
|
||||||
|
|
||||||
void StripCvs( vector<CString> &vs ); // remove all items that end in "cvs"
|
void StripCvs( vector<CString> &vs ); // remove all items that end in "cvs"
|
||||||
|
|||||||
Reference in New Issue
Block a user