• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Created by Martin on 25/07/2017.
3  *
4  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
5  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  */
7 #ifndef TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
8 #define TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
9 
10 #include <string>
11 #include <iosfwd>
12 
13 namespace Catch {
14 
15     bool startsWith( std::string const& s, std::string const& prefix );
16     bool startsWith( std::string const& s, char prefix );
17     bool endsWith( std::string const& s, std::string const& suffix );
18     bool endsWith( std::string const& s, char suffix );
19     bool contains( std::string const& s, std::string const& infix );
20     void toLowerInPlace( std::string& s );
21     std::string toLower( std::string const& s );
22     std::string trim( std::string const& str );
23     bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
24 
25     struct pluralise {
26         pluralise( std::size_t count, std::string const& label );
27 
28         friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
29 
30         std::size_t m_count;
31         std::string m_label;
32     };
33 }
34 
35 #endif // TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
36 
37