iopc::StringUtil Class Reference
[iopccommon]

Various string manipulation utilities. More...

#include <util.h>

List of all members.

Static Public Member Functions

static int splitString (const std::string &input, const std::string &delimiter, std::vector< std::string > &results, bool skipEmpty=false)
 Splits a delimiter delimited string into a vector of strings.
static std::string joinStrings (std::vector< std::string > strings, const std::string &delimiter)
 Concatenates strings using a delimiter.
static std::map< std::string,
std::string > 
createParamMap (const std::string &paramStr)
 Converts a string of format "key1=value1;key2=value2" into a STL map.
static std::string join (const char *string1, const char *string2)
 Concatenates two strings (no delimiter).
static std::string removeFileExt (std::string fileName)
 Removes file extension from a file name.
static int parseInt (const std::string &input)
 Parses integer from a string.
static bool parseBool (const std::string &input)
 Parses a boolean value from a string.
static std::string toString (int i)
 Converts an integer value to string.


Detailed Description

Various string manipulation utilities.

Member Function Documentation

static int iopc::StringUtil::splitString ( const std::string &  input,
const std::string &  delimiter,
std::vector< std::string > &  results,
bool  skipEmpty = false 
) [static]

Splits a delimiter delimited string into a vector of strings.

Parameters:
[in] input The string containing delimiter delimited values
[in] delimiter The delimiting string
[out] results Vector containing the substrings from input
[in] skipEmpty Determines whether to skip empty substrings (two delimiters in sequence). Default is false.
Author:
Paul J. Weiss

static std::string iopc::StringUtil::joinStrings ( std::vector< std::string >  strings,
const std::string &  delimiter 
) [static]

Concatenates strings using a delimiter.

Parameters:
strings The list of strings to be concatenated
delimiter The strings are concatenated using this delimiter.
Returns:
Concatenated string.

static std::map<std::string, std::string> iopc::StringUtil::createParamMap ( const std::string &  paramStr  )  [static]

Converts a string of format "key1=value1;key2=value2" into a STL map.

Key-value pair delimiter is specified by the IOPC_PARAM_DELIMITER macro defined in iopccommon/util.h

Parameters:
paramStr The string to be converted
Returns:
The map containing keys and values from the input string

static std::string iopc::StringUtil::removeFileExt ( std::string  fileName  )  [inline, static]

Removes file extension from a file name.

Parameters:
fileName The file name. May include a path
Returns:
The file name without extension.

int iopc::StringUtil::parseInt ( const std::string &  input  )  [static]

Parses integer from a string.

Returns:
Parsed integer. If the string couldn't be parsed, the behaviour is undefined.

bool iopc::StringUtil::parseBool ( const std::string &  input  )  [static]

Parses a boolean value from a string.

Returns:
true if the input value is "true", false otherwise


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

Generated on Tue Apr 14 16:46:35 2009 for IOPC 2 by  doxygen 1.5.6