stringutils.h

00001 /****************************************************************************************
00002                                           stringutils.h 
00003                                         -----------------
00004     copyright            : (C) 2006 Jean-Luc Perret - Pierre Mahé
00005     email                : jean-luc.perret@unine.ch - pierre.mahe@ensmp.fr
00006  ***************************************************************************************/
00007 
00008 /****************************************************************************************
00009  *                                                                                      *
00010  *      This program is free software; you can redistribute it and/or                   *
00011  *      modify it under the terms of the GNU Lesser General Public                      *
00012  *      License as published by the Free Software Foundation; either                    *
00013  *      version 2.1 of the License, or (at your option) any later version.              *
00014  *                                                                                      *
00015  *      This program is distributed in the hope that it will be useful,                 *
00016  *      but WITHOUT ANY WARRANTY; without even the implied warranty of                  *
00017  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU               *
00018  *      Lesser General Public License for more details.                                 *
00019  *                                                                                      *
00020  *      You should have received a copy of the GNU Lesser General Public                *
00021  *      License along with this library; if not, write to the Free Software             *
00022  *      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA      *
00023  *                                                                                      *
00024  ****************************************************************************************/
00025 
00026 
00027 #ifndef STRINGUTILS_H
00028 #define STRINGUTILS_H
00029 
00030 
00031 #include <string>
00032 #include <vector>
00033 #include <sstream>
00034 
00035 using namespace std;
00036 
00037 
00046 class StringUtils {
00047 public:
00050         static int Split( const string input, const string delimiter, vector<string>& results );
00051 
00054         static string mergeWords(       vector<string>& words, const string separator );
00055 
00058         static int toInt(       const string input );
00059 
00062         static float toFloat(   const string input );
00063 
00066         static string toString( const int input );
00067 
00070         static string toString( const float input );
00071 
00075         static string rmSpace( const string input );
00076 
00079         static string rmTailSpace( const string input );
00080 
00083         static string chomp(string inString);
00084 
00087         static string slashToUnderscore( const string input );
00088 
00091         static string field(string aString, int start, int maxlength);
00092 
00095         static string fill( string aString, int aLength, string aChar = " " );
00096 
00099         static string preFill( string aString, int aLength, string aChar = " " );
00100   
00103         static string preFill( int anInt, int aLength, string aChar = " " );
00104         
00107         static string preFill( float aFloat, int aLength, string aChar = " " );
00108  
00111         static string getPath( string aLocation );
00112         
00115         static string getExtension( string aLocation );
00116         
00119         static string getNoExtension( string aLocation );
00120         
00123         static string getFileName( string aLocation );
00124         
00127         static string right( string aString, uint aLength );
00128 
00131         static string toUpper( string aString );
00132 
00135         static string toLower( string aString );
00136 
00139         static string getFirstNonSpace( string aString );
00140 
00141         //StringUtils();
00142         //~StringUtils();
00143 };
00144 
00145 #endif

Generated on Wed Nov 28 12:12:51 2007 for ChemCpp by  doxygen 1.4.6