28 #ifndef __TERRALIB_COMMON_INTERNAL_STRINGUTILS_H    29 #define __TERRALIB_COMMON_INTERNAL_STRINGUTILS_H    43 #include <boost/cstdint.hpp>    56       char name[std::numeric_limits<boost::int16_t>::digits10 + 2];
    57       sprintf(name, 
"%hd", value);
    68       char name[std::numeric_limits<boost::uint16_t>::digits10 + 2];
    69       sprintf(name, 
"%hu", value);
    80       char name[std::numeric_limits<boost::int32_t>::digits10 + 2];
    81       sprintf(name, 
"%d", value);
    92       char name[std::numeric_limits<boost::uint32_t>::digits10 + 2];
    93       sprintf(name, 
"%u", value);
   104       char name[std::numeric_limits<boost::int64_t>::digits10 + 2];
   105       sprintf(name, 
"%lli", value);
   116       char name[std::numeric_limits<boost::uint64_t>::digits10 + 2];
   117       sprintf(name, 
"%llu", value);
   128       char name[std::numeric_limits<float>::digits10 + std::numeric_limits<float>::digits + 4];
   129       sprintf(name, 
"%f", value);
   140       char name[std::numeric_limits<double>::digits10 + std::numeric_limits<double>::digits + 4];
   141       sprintf(name, 
"%e", value);
   155       sprintf(name, 
"%.*f", precision, value );
   168       size_t size = value.size();
   170       std::string aux(size, 
' ');
   172       for(
size_t i = 0; i < size; ++i)
   173         aux[i] = ((value[i] >= 97) && (value[i] <= 122)) ? (value[i] - 32) : value[i];
   187       size_t size = value.size();
   189       for(
size_t i = 0; i < size; ++i)
   190         value[i] = ((value[i] >= 97) && (value[i] <= 122)) ? (value[i] - 32) : value[i];
   202       size_t size = value.size();
   204       std::string aux(size, 
' ');
   206       for(
size_t i = 0; i < size; ++i)
   207         aux[i] = ((value[i] >= 65) && (value[i] <= 90)) ? (value[i] + 32) : value[i];
   220                          std::vector<std::string>& tokens,
   221                          const std::string& delimiters = 
" ")
   224       size_t lastPos = str.find_first_not_of(delimiters, 0);
   227       size_t pos = str.find_first_of(delimiters, lastPos);
   229       while((std::string::npos != pos) ||
   230             (std::string::npos != lastPos))
   233         tokens.push_back(str.substr(lastPos, pos - lastPos));
   236         lastPos = str.find_first_not_of(delimiters, pos);
   239         pos = str.find_first_of(delimiters, lastPos);
   255                            std::map<std::string, std::string>& kvp,
   256                            const std::string& kvpDelimiter = 
"&",
   257                            const std::string& kvDelimiter = 
"=",
   258                            bool toUpper = 
false)
   264       std::vector<std::string> tokens;
   266       Tokenize(kvpStr, tokens, kvpDelimiter);
   269       size_t size = tokens.size();
   271       for(
size_t i = 0; i < size; ++i)
   273         std::vector<std::string> kv;
   275         Tokenize(tokens[i], kv, kvDelimiter);
   293           for(
size_t k = 1; k < kv.size(); ++k)
   296           size_t pos = aux.size() - 1;
   298           kvp[kv[0]] = aux.erase(pos, 1);
   312       char* cs = 
new char[s.length() + 1];
   313       strncpy(cs, s.c_str(), s.length() + 1);
   326       std::size_t ns = vs.size() ;
   328       char** as = 
new char*[ns + 1];
   332       for(std::size_t i = 0; i< ns; ++i)
   334         as[i] = 
new char[vs[i]->length() + 1];
   336         strncpy(as[i], vs[i]->c_str(), vs[i]->length() + 1);
   351       std::size_t ns = vs.size() ;
   353       char** as = 
new char*[ns + 1];
   357       for(std::size_t i = 0; i< ns; ++i)
   359         as[i] = 
new char[vs[i].length() + 1];
   361         strncpy(as[i], vs[i].c_str(), vs[i].length() + 1);
   406 #endif  // __TERRALIB_COMMON_INTERNAL_STRINGUTILS_H std::string Convert2LCase(const std::string &value)
It converts a string to lower case. 
 
Configuration flags for the TerraLib Common Runtime module. 
 
void ExtractKVP(const std::string &kvpStr, std::map< std::string, std::string > &kvp, const std::string &kvpDelimiter="&", const std::string &kvDelimiter="=", bool toUpper=false)
It extracts a key-value map from a string. 
 
std::string Convert2UCase(const std::string &value)
It converts a string to upper case. 
 
TECOMMONEXPORT void GetAccentuatedUpperVector(std::vector< std::string > &vecUpperIn, std::vector< std::string > &vecUpperOut)
It build two string vectors with special upper case characters and the his respective normal characte...
 
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice. 
 
TECOMMONEXPORT std::string ReplaceSpecialChars(const std::string &str, bool &changed)
It replace special characters of a string. 
 
void Convert2UCaseInPlace(std::string &value)
It converts a string to upper case in place (it doesn't allocate an auxiliar buffer). 
 
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module. 
 
TECOMMONEXPORT void GetAccentuatedLowerVector(std::vector< std::string > &vecLowerIn, std::vector< std::string > &vecLowerOut)
It build two string vectors with special lower case characters and the his respective normal characte...
 
char * CreateCString(const std::string &s)
It converts the C++ string to a C-string. 
 
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string. 
 
char ** CreateCStringArray(const std::vector< std::string * > &vs)
It converts the C++ vector of string pointers to a C array os strings. 
 
TECOMMONEXPORT void GetEspecialCharsFixVector(std::vector< std::string > &especialIn, std::vector< std::string > &especialOut)
It build two string vectors with special characters and the his respective normal characters...