00001 #ifndef __STRINGUtils__ 00002 #define __STRINGUtils__ 00003 00004 #include "TString.h" 00005 #include <sstream> 00006 00007 #include <iterator> 00008 00009 namespace StringUtils { 00010 00011 00012 template <typename T> static TString toTString(const T& t) { 00013 std::ostringstream os; 00014 os<<t; 00015 return (TString)os.str(); 00016 } 00017 template <typename T> static TString VToTString(const T& t, TString delim="," ) { 00018 if (t.size()>0) { 00019 std::ostringstream os; 00020 std::copy(t.begin(), t.end(), std::ostream_iterator<typename T::value_type>(os,delim)); ; 00021 TString val = (TString)os.str(); 00022 return val.Remove(val.Length()-delim.Length()); 00023 } 00024 else return TString(""); 00025 } 00026 00027 std::string TextBox ( std::string text, int width ); 00028 std::string NumberBox ( int number, int width ); 00029 00030 00031 } 00032 00033 #endif