Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

StringUtil.h File Reference

String operation utility. More...

#include <string>
#include <vector>
#include <sstream>

Go to the source code of this file.

Functions

bool isEscaped (const std::string &str, std::string::size_type pos)
 Whether the character is escaped or not.
std::string escape (const std::string str)
 Escape string.
std::string unescape (const std::string str)
 Unescape string.
void eraseHeadBlank (std::string &str)
 Erase the head blank characters of string.
void eraseTailBlank (std::string &str)
 Erase the tail blank characters of string.
void replaceString (std::string &str, const std::string from, const std::string to)
 Replace string.
std::vector< std::string > split (const std::string &input, const std::string &delimiter)
 Split string by delimiter.
bool toBool (std::string str, std::string yes, std::string no, bool default_value=true)
 Convert given string to bool value.
bool isAbsolutePath (const std::string &str)
 Investigate whether the given string is absolute path or not.
bool isURL (const std::string &str)
 Investigate whether the given string is URL or not.
template<class Printable>
std::string otos (Printable n)
 Convert the given object to st::string.
template<typename To>
bool stringTo (To &val, const char *str)
std::vector< std::string > unique_sv (std::vector< std::string > sv)
std::string flatten (std::vector< std::string > sv)
char ** toArgv (const std::vector< std::string > &args)


Detailed Description

String operation utility.

Date:
Date
2007/04/23 04:58:53
Author:
Noriaki Ando <n-ando@aist.go.jp>
Copyright (C) 2003-2005 Task-intelligence Research Group, Intelligent Systems Research Institute, National Institute of Advanced Industrial Science and Technology (AIST), Japan All rights reserved.

Id
StringUtil.h,v 1.9 2007/04/23 04:58:53 n-ando Exp

Function Documentation

void eraseHeadBlank std::string &  str  ) 
 

Erase the head blank characters of string.

void eraseTailBlank std::string &  str  ) 
 

Erase the tail blank characters of string.

std::string escape const std::string  str  ) 
 

Escape string.

The following characters are converted.
HT -> "\t"
LF -> "\n"
CR -> "\r"
FF -> "\f"
Single quote and dobule quote are not processed.

std::string flatten std::vector< std::string >  sv  ) 
 

bool isAbsolutePath const std::string &  str  ) 
 

Investigate whether the given string is absolute path or not.

bool isEscaped const std::string &  str,
std::string::size_type  pos
 

Whether the character is escaped or not.

This operation returns true if the specified character is escaped, and if the specified character is not escaped, it returns false

Parameters:
str The string thath includes the character to be investigated.
pos The position of the character to be investigated.
Returns:
true: the character is escaped, false: the character is not escaped.

bool isURL const std::string &  str  ) 
 

Investigate whether the given string is URL or not.

template<class Printable>
std::string otos Printable  n  ) 
 

Convert the given object to st::string.

void replaceString std::string &  str,
const std::string  from,
const std::string  to
 

Replace string.

std::vector<std::string> split const std::string &  input,
const std::string &  delimiter
 

Split string by delimiter.

template<typename To>
bool stringTo To &  val,
const char *  str
 

char** toArgv const std::vector< std::string > &  args  ) 
 

bool toBool std::string  str,
std::string  yes,
std::string  no,
bool  default_value = true
 

Convert given string to bool value.

std::string unescape const std::string  str  ) 
 

Unescape string.

The following characters are converted.
"\t" -> HT
"\n" -> LF
"\r" -> CR
"\f" -> FF
"\"" -> "
"\'" -> '

std::vector<std::string> unique_sv std::vector< std::string >  sv  ) 
 


Generated on Fri Oct 5 05:16:01 2007 for OpenRTM by  doxygen 1.4.1