SUMO - Simulation of Urban MObility
StringUtils Class Reference

Some static methods for string processing. More...

#include <StringUtils.h>

Collaboration diagram for StringUtils:
Collaboration graph

Static Public Member Functions

static std::string charToHex (unsigned char c)
 
static std::string convertUmlaute (std::string str)
 Converts german "Umlaute" to their latin-version. More...
 
static bool endsWith (const std::string &str, const std::string suffix)
 Checks whether a given string ends with the suffix. More...
 
static std::string escapeXML (const std::string &orig)
 Replaces the standard escapes by their XML entities. More...
 
static unsigned char hexToChar (const std::string &str)
 
static std::string latin1_to_utf8 (std::string str)
 Transfers from Latin 1 (ISO-8859-1) to UTF-8. More...
 
static std::string prune (const std::string &str)
 Removes trailing and leading whitechars. More...
 
static std::string replace (std::string str, const char *what, const char *by)
 
static bool startsWith (const std::string &str, const std::string prefix)
 Checks whether a given string starts with the prefix. More...
 
static std::string to_lower_case (std::string str)
 Transfers the content to lower case. More...
 
static std::string toTimeString (int time)
 Builds a time string (hh:mm:ss) from the given seconds. More...
 
static std::string urlDecode (const std::string &encoded)
 
static std::string urlEncode (const std::string &url, const std::string encodeWhich="")
 

Static Public Attributes

static std::string emptyString
 An empty string. More...
 

Detailed Description

Some static methods for string processing.

Definition at line 45 of file StringUtils.h.

Member Function Documentation

§ charToHex()

std::string StringUtils::charToHex ( unsigned char  c)
static

Definition at line 221 of file StringUtils.cpp.

Referenced by urlEncode().

§ convertUmlaute()

std::string StringUtils::convertUmlaute ( std::string  str)
static

Converts german "Umlaute" to their latin-version.

Definition at line 95 of file StringUtils.cpp.

References replace().

Referenced by PCLoaderDlrNavteq::loadPolyFile(), NIImporter_Vissim::VissimSingleTypeParser::readName(), and NBEdge::reinit().

§ endsWith()

bool StringUtils::endsWith ( const std::string &  str,
const std::string  suffix 
)
static

Checks whether a given string ends with the suffix.

Definition at line 157 of file StringUtils.cpp.

Referenced by NIImporter_OpenStreetMap::EdgesHandler::myStartElement().

§ escapeXML()

§ hexToChar()

unsigned char StringUtils::hexToChar ( const std::string &  str)
static

Definition at line 232 of file StringUtils.cpp.

Referenced by urlDecode().

§ latin1_to_utf8()

std::string StringUtils::latin1_to_utf8 ( std::string  str)
static

Transfers from Latin 1 (ISO-8859-1) to UTF-8.

Definition at line 78 of file StringUtils.cpp.

Referenced by PCLoaderArcView::load().

§ prune()

§ replace()

std::string StringUtils::replace ( std::string  str,
const char *  what,
const char *  by 
)
static

Replaces all occurences of the second string by the third string within the first string

Definition at line 113 of file StringUtils.cpp.

Referenced by convertUmlaute(), escapeXML(), and NIImporter_ArcView::load().

§ startsWith()

bool StringUtils::startsWith ( const std::string &  str,
const std::string  prefix 
)
static

Checks whether a given string starts with the prefix.

Definition at line 151 of file StringUtils.cpp.

Referenced by NWWriter_DlrNavteq::getRoadClass(), NBHelpers::loadEdgesFromFile(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().

§ to_lower_case()

§ toTimeString()

std::string StringUtils::toTimeString ( int  time)
static

Builds a time string (hh:mm:ss) from the given seconds.

Definition at line 131 of file StringUtils.cpp.

§ urlDecode()

std::string StringUtils::urlDecode ( const std::string &  encoded)
static

Definition at line 204 of file StringUtils.cpp.

References hexToChar().

Referenced by OptionsCont::relocateFiles().

§ urlEncode()

std::string StringUtils::urlEncode ( const std::string &  url,
const std::string  encodeWhich = "" 
)
static

Definition at line 180 of file StringUtils.cpp.

References charToHex().

Referenced by Option_FileName::getValueString().

Field Documentation

§ emptyString

std::string StringUtils::emptyString
static

An empty string.

Definition at line 84 of file StringUtils.h.

Referenced by MSPerson::getNextEdge(), and GUIGlObject::getParentName().


The documentation for this class was generated from the following files: