|
StringUtils.hhGo to the documentation of this file.00001 #ifndef StringUtils_hh 00002 #define StringUtils_hh 00003 00004 #include <strstream> 00005 #include <string> 00006 #include <cctype> 00007 00008 namespace StringUtils 00009 { 00010 void strip( std::string& str ); 00011 template <class T> std::string x2s( T t ); 00012 template <class T> T s2x( const std::string& s ); 00013 std::strstream& operator >> ( std::strstream& in, bool& w ); 00014 bool isnum( const std::string& s ); 00015 void toupper( std::string &s ); 00016 00017 template<class T>std::string x2s( T what ) 00018 { 00019 std::strstream str; 00020 00021 str << what << std::ends; 00022 std::string s( str.str() ); 00023 str.freeze(0); 00024 return s; 00025 } 00026 00027 template <class T> T s2x( const std::string& s ) 00028 { 00029 std::strstream str; 00030 00031 str << s << std::ends; 00032 T t; 00033 str >> t; 00034 str.freeze(0); 00035 return t; 00036 } 00037 00038 inline void toupper( std::string &s ) 00039 { 00040 for( unsigned int i=0; i< s.size(); i++ ) 00041 s[i] = std::toupper( s[i] ); 00042 } 00043 } 00044 00045 #endif
LeoArg (C) under the terms of the
GPL
by
King Leo (Martin Oberzalek)
Documentation created by Doxygen 1.2.2 |