OpenRTM-aist-Python 2.0.0
Classes | Functions
C:/docs/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py File Reference

String operation utility. More...

Classes

class  OpenRTM_aist.StringUtil.escape_functor
 
class  OpenRTM_aist.StringUtil.unescape_functor
 
class  OpenRTM_aist.StringUtil.unique_strvec
 

Functions

def OpenRTM_aist.StringUtil.isEscaped (_str, pos)
 
def OpenRTM_aist.StringUtil.for_each (_str, instance)
 
def OpenRTM_aist.StringUtil.escape (_str)
 
def OpenRTM_aist.StringUtil.unescape (_str)
 
def OpenRTM_aist.StringUtil.eraseBlank (_str)
 
def OpenRTM_aist.StringUtil.eraseHeadBlank (_str)
 
def OpenRTM_aist.StringUtil.eraseTailBlank (_str)
 
def OpenRTM_aist.StringUtil.replaceString (_str, _from, _to)
 
def OpenRTM_aist.StringUtil.split (input, delimiter)
 
def OpenRTM_aist.StringUtil.toBool (_str, yes, no, default_value=None)
 
def OpenRTM_aist.StringUtil.includes (_list, value, ignore_case=True)
 
def OpenRTM_aist.StringUtil.isAbsolutePath (str)
 
def OpenRTM_aist.StringUtil.isURL (str)
 
def OpenRTM_aist.StringUtil.otos (n)
 
def OpenRTM_aist.StringUtil.stringTo (_type, _str)
 
def OpenRTM_aist.StringUtil.unique_sv (sv)
 
def OpenRTM_aist.StringUtil.flatten (sv, delimiter=", ")
 
def OpenRTM_aist.StringUtil.toArgv (args)
 
def OpenRTM_aist.StringUtil.urlparam2map (_str)
 
def OpenRTM_aist.StringUtil.replaceEnv (_str)
 
def OpenRTM_aist.StringUtil.findFile (dir, filename, filelist)
 
def OpenRTM_aist.StringUtil.getFileList (dir, ext, filelist=None)
 
def OpenRTM_aist.StringUtil.parseArgs (args)
 

Detailed Description

String operation utility.

Date
Date
Author
Noriaki Ando n-and.nosp@m.o@ai.nosp@m.st.go.nosp@m..jp and Shinji Kurihara

Copyright (C) 2003-2008 Task-intelligence Research Group, Intelligent Systems Research Institute, National Institute of Advanced Industrial Science and Technology (AIST), Japan All rights reserved.

Function Documentation

◆ eraseBlank()

def OpenRTM_aist.StringUtil.eraseBlank (   _str)

Erase blank characters of string

Erase blank characters that exist at the head of the given string. Space ' 'and tab '\t' are supported as the blank character.

Parameters
strThe target blank characters of string for the erase

◆ eraseHeadBlank()

def OpenRTM_aist.StringUtil.eraseHeadBlank (   _str)

Erase the head blank characters of string

◆ eraseTailBlank()

def OpenRTM_aist.StringUtil.eraseTailBlank (   _str)

Erase the tail blank characters of string

◆ escape()

def OpenRTM_aist.StringUtil.escape (   _str)

Escape string

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

◆ findFile()

def OpenRTM_aist.StringUtil.findFile (   dir,
  filename,
  filelist 
)

Parameters
dir
filename
filelist

◆ flatten()

def OpenRTM_aist.StringUtil.flatten (   sv,
  delimiter = ", " 
)

Create CSV file from the given string list

Create CSV that arranged each element of the character string list given by the argument. If the string list is empty, the null will be returned.

Parameters
svThe target string list for creating CSV
delimiterDelimiter string between connected words (default: ",")
Returns
String of CSV creating result

◆ getFileList()

def OpenRTM_aist.StringUtil.getFileList (   dir,
  ext,
  filelist = None 
)

Parameters
dir
ext
filelist

◆ includes()

def OpenRTM_aist.StringUtil.includes (   _list,
  value,
  ignore_case = True 
)

Include if a string is included in string list

if the second argument is included in the comma separated string list of the first argument, This operation returns "true value".

Parameters
listThe target comma separated string
valueThe searched string
Returns
true: included, false: not included

bool includes(const vstring& list, std::string value, bool ignore_case = true);

◆ isAbsolutePath()

def OpenRTM_aist.StringUtil.isAbsolutePath (   str)

Investigate whether the given string is absolute path or not

◆ isEscaped()

def OpenRTM_aist.StringUtil.isEscaped (   _str,
  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
strThe string thath includes the character to be investigated.
posThe position of the character to be investigated.
Returns
true: the character is escaped, false: the character is not escaped.

◆ isURL()

def OpenRTM_aist.StringUtil.isURL (   str)

Investigate whether the given string is URL or not

◆ otos()

def OpenRTM_aist.StringUtil.otos (   n)

Convert the given object to st::string.

◆ parseArgs()

def OpenRTM_aist.StringUtil.parseArgs (   args)

Parse string as argument list

Parameters
args
Returns

◆ replaceEnv()

def OpenRTM_aist.StringUtil.replaceEnv (   _str)

Parameters
_str
Returns

◆ replaceString()

def OpenRTM_aist.StringUtil.replaceString (   _str,
  _from,
  _to 
)

Replace string

◆ split()

def OpenRTM_aist.StringUtil.split (   input,
  delimiter 
)

Split string by delimiter

◆ stringTo()

def OpenRTM_aist.StringUtil.stringTo (   _type,
  _str 
)

Convert the given object to st::string.

◆ toBool()

def OpenRTM_aist.StringUtil.toBool (   _str,
  yes,
  no,
  default_value = None 
)

Convert given string to bool value

◆ unescape()

def OpenRTM_aist.StringUtil.unescape (   _str)

Unescape string

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

◆ urlparam2map()

def OpenRTM_aist.StringUtil.urlparam2map (   _str)

Investigate whether the given string is URL or not

URL parameter description such as something?key0=value0&key1=value1.... is analyzed. Right hand side string of '?' character is decomposed and it is converted into std::map<std::string, std::string> type.The following string are devided by '&' and then '=' character is searched. Right-hand-side value and left-hand-side value of '=' are stored as key and value in the map.

Parameters
strThe target string for decomposed
Returns
decomposed key-values in map