add BeginsWith

This commit is contained in:
Chris Danford
2005-10-27 04:51:47 +00:00
parent 0ac45b8853
commit cdb7215971
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -661,6 +661,15 @@ void StripCrnl(CString &s)
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 )
{
ASSERT( !sEnding.empty() );
+1
View File
@@ -326,6 +326,7 @@ inline T Decrement( T a ) { --a; return a; }
void TrimLeft(CString &str, const char *s = "\r\n\t ");
void TrimRight(CString &str, const char *s = "\r\n\t ");
void StripCrnl(CString &s);
bool BeginsWith( const CString &sTestThis, const CString &sBeginning );
bool EndsWith( const CString &sTestThis, const CString &sEnding );
void StripCvs( vector<CString> &vs ); // remove all items that end in "cvs"