tmw/src/utils/stringutils.h File Reference

#include <string>
#include <sstream>

Go to the source code of this file.

Functions

std::string & trim (std::string &str)
 Trims spaces off the end and the beginning of the given string.
std::string & toLower (std::string &str)
 Converts the given string to lower case.
template<typename T>
std::string toString (const T &arg)
 Converts the given value to a string using std::stringstream.
const char * ipToString (int address)
 Converts the given IP address to a string.
std::string & removeBadChars (std::string &str)
 Removes bad characters from a string.


Function Documentation

const char* ipToString ( int  address  ) 

Converts the given IP address to a string.

The returned string is statically allocated, and shouldn't be freed. It is changed upon the next use of this method.

Parameters:
address the address to convert to a string
Returns:
the string representation of the address

Definition at line 52 of file stringutils.cpp.

std::string& removeBadChars ( std::string &  str  ) 

Removes bad characters from a string.

Parameters:
str the string to remove the bad chars from
Returns:
a reference to the string without bad chars

Definition at line 65 of file stringutils.cpp.

std::string& toLower ( std::string &  str  ) 

Converts the given string to lower case.

Parameters:
str the string to convert to lower case
Returns:
a reference to the given string converted to lower case

Definition at line 46 of file stringutils.cpp.

template<typename T>
std::string toString ( const T &  arg  )  [inline]

Converts the given value to a string using std::stringstream.

Parameters:
arg the value to convert to a string
Returns:
the string representation of arg

Definition at line 50 of file stringutils.h.

std::string& trim ( std::string &  str  ) 

Trims spaces off the end and the beginning of the given string.

Parameters:
str the string to trim spaces off
Returns:
a reference to the trimmed string

Definition at line 26 of file stringutils.cpp.


Generated on Sun Apr 26 17:30:42 2009 for The Mana World by  doxygen 1.5.5