diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 6f137408ab..d7fe33ade4 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -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() ); diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 6f6f99ac92..d85fee28a6 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -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 &vs ); // remove all items that end in "cvs"