Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:46

0001 #ifndef BOOST_THREAD_DETAIL_STRING_TRIM_HPP_INCLUDED
0002 #define BOOST_THREAD_DETAIL_STRING_TRIM_HPP_INCLUDED
0003 
0004 // Copyright 2023 Peter Dimov
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // https://www.boost.org/LICENSE_1_0.txt
0007 
0008 #include <string>
0009 
0010 namespace boost
0011 {
0012 namespace thread_detail
0013 {
0014 
0015 inline std::string string_trim( std::string const& s )
0016 {
0017     std::size_t i = s.find_first_not_of( " \t\r\n" );
0018 
0019     if( i == std::string::npos ) return std::string();
0020 
0021     std::size_t j = s.find_last_not_of( " \t\r\n" );
0022 
0023     return s.substr( i, j + 1 - i );
0024 }
0025 
0026 } // namespace thread_detail
0027 } // namespace boost
0028 
0029 #endif // #ifndef BOOST_THREAD_DETAIL_STRING_TRIM_HPP_INCLUDED