Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT

  WRITE ARTICLE

 ALL


  C++ : string beginWith and endWith

C++ is an very powerful programming language. It is efficient and flexible. When writing C++ programs, we may often need to process strings and often we need to check whether a string begin with some substring or end with some substring. We can use following functions to ahieve these:     static bool beginWith(const std::string str,const std::string needle){        return (!str.compare(0,needle.length(),needle));    }    ...

4,385 0 0          C++ BEGINWITH ENDWITH