StringUtil.h

String operation utility [詳細]

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

ソースコードを見る。

関数

bool isEscaped (const std::string &str, std::string::size_type pos)
 文字列がエスケープされているか判断する
std::string escape (const std::string str)
 文字列をエスケープする
std::string unescape (const std::string str)
 文字列のエスケープを戻す
void eraseHeadBlank (std::string &str)
 文字列の先頭の空白文字を削除する
void eraseTailBlank (std::string &str)
 文字列の末尾の空白文字を削除する
void replaceString (std::string &str, const std::string from, const std::string to)
 文字列を置き換える
std::vector< std::string > split (const std::string &input, const std::string &delimiter)
 文字列を分割文字で分割する
bool toBool (std::string str, std::string yes, std::string no, bool default_value=true)
 与えられた文字列をbool値に変換する
bool isAbsolutePath (const std::string &str)
 与えられた文字列が絶対パスかどうかを判断する
bool isURL (const std::string &str)
 与えられた文字列がURLかどうかを判断する
template<class Printable>
std::string otos (Printable n)
 与えられたオブジェクトをstdstringに変換
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)


説明

String operation utility

日付:
Date
2007/04/23 04:58:53
作者:
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

関数

void eraseHeadBlank std::string &  str  ) 
 

文字列の先頭の空白文字を削除する

void eraseTailBlank std::string &  str  ) 
 

文字列の末尾の空白文字を削除する

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

文字列をエスケープする

次の文字をエスケープシーケンスに変換する。
HT -> "\t"
LF -> "\n"
CR -> "\r"
FF -> "\f"
シングルクオート、ダブルクオートについてはとくに処理はしない。

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

bool isAbsolutePath const std::string &  str  ) 
 

与えられた文字列が絶対パスかどうかを判断する

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

文字列がエスケープされているか判断する

指定した文字がエスケープされていればtrue、されていなければfalseを返す。

引数:
str エスケープされているかどうか判断する文字を含む文字列
pos エスケープされているかどうか判断する文字の位置
戻り値:
指定した文字がエスケープされていれば true, それ以外は false

bool isURL const std::string &  str  ) 
 

与えられた文字列がURLかどうかを判断する

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

与えられたオブジェクトをstdstringに変換

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

文字列を置き換える

std::vector<std::string> split const std::string &  input,
const std::string &  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
 

与えられた文字列をbool値に変換する

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

文字列のエスケープを戻す

次のエスケープシーケンスを文字に変換する。
"\t" -> HT
"\n" -> LF
"\r" -> CR
"\f" -> FF
"\"" -> "
"\'" -> '

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


OpenRTMに対してTue Sep 25 00:45:55 2007に生成されました。  doxygen 1.4.6