PARTONS/ElementaryUtils  
Basic utility softwares (Logger, threads, etc)
Static Public Member Functions | Static Public Attributes | List of all members
ElemUtils::StringUtils Class Reference

Manipulations et traitements sur les chaines de caracteres. More...

Static Public Member Functions

static bool isEmpty (const std::string &str)
 Test si la chaine de caracteres cible est NULL ou vide "". More...
 
static bool equals (const std::string &str, const std::string &str2)
 Applique une comparaison entre la chaine 1 et 2 en tenant compte de la casse. More...
 
static bool equalsIgnoreCase (const std::string &chaine, const std::string &chaine2, const bool &toUpperCase=true)
 Applique une comparaison entre la chaine 1 et 2 sans tenir compte de la casse. More...
 
static bool contains (const std::string &str, const std::string &searchString)
 
static bool containsIgnoreCase (std::string *chaine, std::string *searchString, bool toUpperCase)
 
static void replaceAll (std::string &str, const std::string &searchString, const std::string &replaceString)
 
static void replaceAllIgnoreCase (std::string *chaine, std::string *searchString, std::string *replaceString, bool toUpperCase)
 
static void trim (std::string &str, const std::string &whitespace=" \t")
 
static void trimAll (std::string &str, const std::string &whitespace=" \t")
 
static unsigned int count (std::string str, const std::string &searchString)
 
static std::vector< std::string > split (const std::string &chaine, char splitCharacter)
 
static std::vector< std::string > split (const std::string &chaine, const std::string &splitSymbols)
 
static std::string vectorToString (std::vector< std::string > *vector)
 Transforme un vector de string en une chaine de caracteres. More...
 
static void to_upperCase (std::string &chaine)
 
static void to_lowerCase (std::string *chaine)
 
static std::pair< std::string, std::vector< char > > fromStringToArrayOfChar (const std::string &string)
 
static std::string removeAfterLast (const std::string &chaine, const char lastCharacter)
 
static size_t findFirstJustAfter (const std::string &file, const std::string &pattern, const size_t startIndex=0)
 Find first occurrence of the pattern in the string and return index position on the string where the last character is matching pattern. More...
 
static size_t findFirst (const std::string &file, const std::string &pattern, const size_t startIndex=0)
 Find first occurrence of the pattern in the string and return index position on the string where pattern is starting. More...
 
static std::string formatDate (const time_t &time, const std::string &format)
 

Static Public Attributes

static std::string EMPTY = ""
 

Detailed Description

Manipulations et traitements sur les chaines de caracteres.

Member Function Documentation

◆ contains()

bool ElemUtils::StringUtils::contains ( const std::string &  str,
const std::string &  searchString 
)
static

◆ containsIgnoreCase()

bool ElemUtils::StringUtils::containsIgnoreCase ( std::string *  chaine,
std::string *  searchString,
bool  toUpperCase 
)
static

◆ count()

unsigned int ElemUtils::StringUtils::count ( std::string  str,
const std::string &  searchString 
)
static

◆ equals()

static bool ElemUtils::StringUtils::equals ( const std::string &  str,
const std::string &  str2 
)
static

Applique une comparaison entre la chaine 1 et 2 en tenant compte de la casse.

Parameters
_chaine1: chaine de caracteres a comparer
_chaine2: chaine de caracteres a comparer
Returns
bool : true si les deux chaines de caracteres sont egales

◆ equalsIgnoreCase()

static bool ElemUtils::StringUtils::equalsIgnoreCase ( const std::string &  chaine,
const std::string &  chaine2,
const bool &  toUpperCase = true 
)
static

Applique une comparaison entre la chaine 1 et 2 sans tenir compte de la casse.

Parameters
_chaine1: chaine de caracteres a comparer
_chaine2: chaine de caracteres a comparer
Returns
bool : true si les deux chaines de caracteres sont egales

◆ findFirst()

size_t ElemUtils::StringUtils::findFirst ( const std::string &  file,
const std::string &  pattern,
const size_t  startIndex = 0 
)
static

Find first occurrence of the pattern in the string and return index position on the string where pattern is starting.

Parameters
file
pattern
startIndex
Returns

◆ findFirstJustAfter()

size_t ElemUtils::StringUtils::findFirstJustAfter ( const std::string &  file,
const std::string &  pattern,
const size_t  startIndex = 0 
)
static

Find first occurrence of the pattern in the string and return index position on the string where the last character is matching pattern.

Parameters
file
pattern
startIndex
Returns

◆ formatDate()

std::string ElemUtils::StringUtils::formatDate ( const time_t &  time,
const std::string &  format 
)
static

◆ fromStringToArrayOfChar()

std::pair< std::string, std::vector< char > > ElemUtils::StringUtils::fromStringToArrayOfChar ( const std::string &  string)
static

◆ isEmpty()

static bool ElemUtils::StringUtils::isEmpty ( const std::string &  str)
static

Test si la chaine de caracteres cible est NULL ou vide "".

Parameters
str: chaine de caracteres a tester
Returns
bool

◆ removeAfterLast()

std::string ElemUtils::StringUtils::removeAfterLast ( const std::string &  chaine,
const char  lastCharacter 
)
static

◆ replaceAll()

void ElemUtils::StringUtils::replaceAll ( std::string &  str,
const std::string &  searchString,
const std::string &  replaceString 
)
static

◆ replaceAllIgnoreCase()

void ElemUtils::StringUtils::replaceAllIgnoreCase ( std::string *  chaine,
std::string *  searchString,
std::string *  replaceString,
bool  toUpperCase 
)
static

◆ split() [1/2]

std::vector< std::string > ElemUtils::StringUtils::split ( const std::string &  chaine,
char  splitCharacter 
)
static

◆ split() [2/2]

std::vector< std::string > ElemUtils::StringUtils::split ( const std::string &  chaine,
const std::string &  splitSymbols 
)
static

◆ to_lowerCase()

void ElemUtils::StringUtils::to_lowerCase ( std::string *  chaine)
static

◆ to_upperCase()

void ElemUtils::StringUtils::to_upperCase ( std::string &  chaine)
static

◆ trim()

void ElemUtils::StringUtils::trim ( std::string &  str,
const std::string &  whitespace = " \t" 
)
static

◆ trimAll()

void ElemUtils::StringUtils::trimAll ( std::string &  str,
const std::string &  whitespace = " \t" 
)
static

◆ vectorToString()

static std::string ElemUtils::StringUtils::vectorToString ( std::vector< std::string > *  vector)
static

Transforme un vector de string en une chaine de caracteres.

Parameters
vector: vector a transformer en chaine de caracteres
Returns
std::string

Member Data Documentation

◆ EMPTY

std::string ElemUtils::StringUtils::EMPTY = ""
static

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