![]() |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
#include "string_function.h"
Go to the source code of this file.
Functions | |
std::string | copyStr (const std::string &str, long unsigned int begin, long unsigned int nbCh) |
Copy a string of nbCh starting from begin char. More... | |
size_t | countNbChar (const std::string &str, char ch) |
Count number of chararacters ch in string. More... | |
size_t | countStrInStr (const std::string &src, const std::string &patern) |
Count the number of patern in string. More... | |
std::list< std::string > | cutStringList (const std::string &str, char separator) |
Cut a string the the given separator char. More... | |
std::list< std::string > | cutStringOnSpacesList (const std::string &str) |
Cut a string on white characters ('\t' ou ' ') More... | |
std::vector< std::string > | cutStringOnSpacesVector (const std::string &str) |
Cut a string on white characters ('\t' ou ' ') More... | |
std::vector< std::string > | cutStringVector (const std::string &str, char separator) |
Cut a string the the given separator char. More... | |
std::string | eraseCharInStr (const std::string &str, char ch) |
copie la string str en effaçant le caractère ch More... | |
std::string | eraseCharsInStr (const std::string &str, const std::string &rmchs) |
copie la string str en effaçant les caractères rmchs More... | |
std::string | eraseFirstCharsInStr (const std::string &str, const std::string &chars) |
Erase first char in a string. More... | |
std::string | eraseFirstLastChars (const std::string &str, const std::string &chars) |
Erase first and last char in a string. More... | |
std::vector< std::string > | eraseFirstLastChars (const std::vector< std::string > &vecStr, const std::string &chars) |
Erase first and last char in a vector of strings. More... | |
std::string | eraseLastCharsInStr (const std::string &str, const std::string &chars) |
Erase first and last char in a string. More... | |
bool | findCharsInString (const std::string &str, const std::string &chars) |
Find multiple chars in a string. More... | |
bool | findInListString (const std::list< std::string > &listStr, const std::string &str) |
Find a string in a list of string. More... | |
bool | findInString (const std::string &str, char ch) |
Find a char in a string. More... | |
bool | findInVectorString (const std::vector< std::string > &vecStr, const std::string &str) |
Find a string in a vector of string. More... | |
bool | isSameBegining (const std::string &str, const std::string &beginig) |
Check if two string start the same way. More... | |
std::string | phoenix_charToString (const char *ch) |
Convert a char pointer into a string (event if the char pointer is NULL) More... | |
std::string | phoenix_escapeStr (const std::string &src, const std::string &strCharToEscape, const std::string &escapeStr) |
Escape given string with passed characters. More... | |
std::string | phoenix_getCommonBegining (const std::string &str1, const std::string &str2) |
Get the common begining between str1 and str2. More... | |
std::string | replaceCharInStr (const std::string &str, char find, char replace) |
fonction qui remplace un caractère par un autre dans une string More... | |
std::string | replaceCharInStr (const std::string &str, char find, const std::string &replace) |
fonction qui remplace un caractère par un autre dans une string More... | |
std::string | replaceCharsInStr (const std::string &str, const std::string &strFind, char replace) |
Replace all char in the strFind by char replace. More... | |
std::string | replaceListStrInStr (const std::string &src, const std::list< std::string > &vecPatern, const std::string &replace) |
Replace all the list patern in the string srcDest by the replace string. More... | |
void | replaceListStrInStr (std::string &srcDest, const std::list< std::string > &listPatern, const std::string &replace) |
Replace all the list patern in the string srcDest by the replace string. More... | |
std::string | replaceStrInStr (const std::string &src, const std::map< std::string, std::string > &mapReplace) |
Replace a map of string in a string. More... | |
std::string | replaceStrInStr (const std::string &src, const std::string &patern, const std::string &replace) |
Replace a patern by an other in the input string. More... | |
std::vector< std::string > | replaceStrInStr (const std::vector< std::string > &vecSrc, const std::string &patern, const std::string &replace) |
Replace a patern by an other in the input string in a vector of string. More... | |
void | replaceStrInStr (std::string &out, const std::string &src, const std::map< std::string, std::string > &mapReplace) |
Replace a map of string in a string. More... | |
void | replaceStrInStr (std::string &out, const std::string &src, const std::string &patern, const std::string &replace) |
Replace a patern by an other in the input string. More... | |
std::string | replaceVectorStrInStr (const std::string &src, const std::vector< std::string > &vecPatern, const std::string &replace) |
Replace all the vector patern in the string srcDest by the replace string. More... | |
void | replaceVectorStrInStr (std::string &srcDest, const std::vector< std::string > &vecPatern, const std::string &replace) |
Replace all the vector patern in the string srcDest by the replace string. More... | |
std::string copyStr | ( | const std::string & | str, |
long unsigned int | begin, | ||
long unsigned int | nbCh | ||
) |
Copy a string of nbCh starting from begin char.
str | : string to be copied |
begin | : first character index |
nbCh | : number of characters to be copied |
Definition at line 515 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by eraseLongestExtension(), and testStringFunction().
size_t countNbChar | ( | const std::string & | str, |
char | ch | ||
) |
Count number of chararacters ch in string.
str | : string to be used |
ch | : character to be serached |
Definition at line 145 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by eraseExtension(), getLongestExtention(), printAllCol(), printAllColCerr(), and testStringFunction().
size_t countStrInStr | ( | const std::string & | src, |
const std::string & | patern | ||
) |
Count the number of patern in string.
src | : string to be analysed |
patern | : patern to be serached |
Definition at line 237 of file string_function.cpp.
Referenced by testStringFunction().
std::list<std::string> cutStringList | ( | const std::string & | str, |
char | separator | ||
) |
Cut a string the the given separator char.
str | : string to be cut |
separator | : separtor char |
Definition at line 428 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by checkResultSeparator(), createDirectoriesIfNotExist(), getUnderPath(), removePathDots(), and testStringFunction().
std::list<std::string> cutStringOnSpacesList | ( | const std::string & | str | ) |
Cut a string on white characters ('\t' ou ' ')
str | : string to be cut |
Definition at line 467 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by testStringFunction().
std::vector<std::string> cutStringOnSpacesVector | ( | const std::string & | str | ) |
Cut a string on white characters ('\t' ou ' ')
str | : string to be cut |
Definition at line 490 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by testStringFunction().
std::vector<std::string> cutStringVector | ( | const std::string & | str, |
char | separator | ||
) |
Cut a string the the given separator char.
str | : string to be cut |
separator | : separtor char |
Definition at line 448 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by phoenix_find(), and testStringFunction().
std::string eraseCharInStr | ( | const std::string & | str, |
char | ch | ||
) |
copie la string str en effaçant le caractère ch
str | : chaîne à copier |
ch | : caractère à effacer |
Definition at line 160 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by eraseCharsInStr(), and testStringFunction().
std::string eraseCharsInStr | ( | const std::string & | str, |
const std::string & | rmchs | ||
) |
copie la string str en effaçant les caractères rmchs
str | : chaîne à copier |
rmchs | : caractères à effacer |
Definition at line 173 of file string_function.cpp.
References eraseCharInStr(), and createReleaseCurl::str.
Referenced by getCurrentNodeName(), and testStringFunction().
std::string eraseFirstCharsInStr | ( | const std::string & | str, |
const std::string & | chars | ||
) |
Erase first char in a string.
str | : string to be modifed |
chars | : chars to be searched and removed |
Definition at line 77 of file string_function.cpp.
References findInString(), and createReleaseCurl::str.
Referenced by checkEraseFirstChars(), and eraseFirstLastChars().
std::string eraseFirstLastChars | ( | const std::string & | str, |
const std::string & | chars | ||
) |
Erase first and last char in a string.
str | : string to be modifed |
chars | : chars to be searched and removed |
Definition at line 122 of file string_function.cpp.
References eraseFirstCharsInStr(), eraseLastCharsInStr(), and createReleaseCurl::str.
Referenced by checkEraseFirstLastChars(), checkEraseFirstLastCharsVector(), and eraseFirstLastChars().
std::vector<std::string> eraseFirstLastChars | ( | const std::vector< std::string > & | vecStr, |
const std::string & | chars | ||
) |
Erase first and last char in a vector of strings.
vecStr | : vector of string to be modifed |
chars | : chars to be searched and removed |
Definition at line 132 of file string_function.cpp.
References eraseFirstLastChars().
std::string eraseLastCharsInStr | ( | const std::string & | str, |
const std::string & | chars | ||
) |
Erase first and last char in a string.
str | : string to be modifed |
chars | : chars to be searched and removed |
Definition at line 97 of file string_function.cpp.
References findInString(), and createReleaseCurl::str.
Referenced by checkEraseLastChars(), eraseFirstLastChars(), and testFindInListString().
bool findCharsInString | ( | const std::string & | str, |
const std::string & | chars | ||
) |
Find multiple chars in a string.
str | : string to be used |
chars | : chars to be searched |
Definition at line 29 of file string_function.cpp.
References findInString(), and createReleaseCurl::str.
Referenced by testStringFunction().
bool findInListString | ( | const std::list< std::string > & | listStr, |
const std::string & | str | ||
) |
Find a string in a list of string.
listStr | : list of string |
str | : string to be searched |
Definition at line 45 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by testFindInListString().
bool findInString | ( | const std::string & | str, |
char | ch | ||
) |
Find a char in a string.
str | : string to be used |
ch | : char to be searched |
Definition at line 15 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by eraseFirstCharsInStr(), eraseLastCharsInStr(), findCharsInString(), getExtention(), phoenix_escapeStr(), and testStringFunction().
bool findInVectorString | ( | const std::vector< std::string > & | vecStr, |
const std::string & | str | ||
) |
Find a string in a vector of string.
vecStr | : vector of string |
str | : string to be searched |
Definition at line 61 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by testFindInListString().
bool isSameBegining | ( | const std::string & | str, |
const std::string & | beginig | ||
) |
Check if two string start the same way.
str | : string to be tested |
beginig | : begining to be checked |
Definition at line 531 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by ArgParser::ArgParser(), completePathDir(), OptionParser::getLongOptionValue(), OptionMode::getPossibleMode(), OptionMode::getPossibleOption(), Option::getPossibleOption(), OptionParser::getPossibleOtherOption(), Option::parsePartOption(), path_completion_all(), path_completion_dirOnly(), and testStringFunction().
std::string phoenix_charToString | ( | const char * | ch | ) |
Convert a char pointer into a string (event if the char pointer is NULL)
ch | : char pointer to be converted into a string |
Definition at line 547 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by testCharToString().
std::string phoenix_escapeStr | ( | const std::string & | src, |
const std::string & | strCharToEscape, | ||
const std::string & | escapeStr | ||
) |
Escape given string with passed characters.
src | : string to be excaped |
strCharToEscape | : list of the characters to be escaped |
escapeStr | : escape sequence (could be one char) |
Definition at line 411 of file string_function.cpp.
References findInString().
Referenced by phoenix_listArgToString(), and testEscapeString().
std::string phoenix_getCommonBegining | ( | const std::string & | str1, |
const std::string & | str2 | ||
) |
Get the common begining between str1 and str2.
str1 | : string |
str2 | : string |
Definition at line 561 of file string_function.cpp.
Referenced by testGetCommonBegning().
std::string replaceCharInStr | ( | const std::string & | str, |
char | find, | ||
char | replace | ||
) |
fonction qui remplace un caractère par un autre dans une string
str | : string à modifier |
find | : caractère à trouver dans la string |
replace | : caractère à remplacer dans la string |
Definition at line 187 of file string_function.cpp.
References createReleaseCurl::str.
Referenced by replaceCharsInStr(), and testStringFunction().
std::string replaceCharInStr | ( | const std::string & | str, |
char | find, | ||
const std::string & | replace | ||
) |
fonction qui remplace un caractère par un autre dans une string
str | : string à modifier |
find | : caractère à trouver dans la string |
replace | : chaîne à remplacer dans la string |
Definition at line 220 of file string_function.cpp.
References createReleaseCurl::str.
std::string replaceCharsInStr | ( | const std::string & | str, |
const std::string & | strFind, | ||
char | replace | ||
) |
Replace all char in the strFind by char replace.
str | : string to be modified |
strFind | : string of the characters to be found |
replace | : character to be found |
Definition at line 205 of file string_function.cpp.
References replaceCharInStr(), and createReleaseCurl::str.
Referenced by testStringFunction().
std::string replaceListStrInStr | ( | const std::string & | src, |
const std::list< std::string > & | vecPatern, | ||
const std::string & | replace | ||
) |
Replace all the list patern in the string srcDest by the replace string.
src | : source string |
vecPatern | : vector of the paterns we want to search |
replace | : string we want to replace |
Definition at line 399 of file string_function.cpp.
References replaceListStrInStr().
void replaceListStrInStr | ( | std::string & | srcDest, |
const std::list< std::string > & | listPatern, | ||
const std::string & | replace | ||
) |
Replace all the list patern in the string srcDest by the replace string.
[out] | srcDest | : source and modified string |
listPatern | : vector of the paterns we want to search | |
replace | : string we want to replace |
Definition at line 346 of file string_function.cpp.
References replaceStrInStr().
Referenced by checkReplaceListStrInStr(), and replaceListStrInStr().
std::string replaceStrInStr | ( | const std::string & | src, |
const std::map< std::string, std::string > & | mapReplace | ||
) |
Replace a map of string in a string.
src | : source string |
mapReplace | : map of patterns (keys) and value to replace (values) |
Definition at line 375 of file string_function.cpp.
References replaceStrInStr().
std::string replaceStrInStr | ( | const std::string & | src, |
const std::string & | patern, | ||
const std::string & | replace | ||
) |
Replace a patern by an other in the input string.
src | : input string |
patern | : patern to be searched |
replace | : string which replace patern |
Definition at line 309 of file string_function.cpp.
References replaceStrInStr().
std::vector<std::string> replaceStrInStr | ( | const std::vector< std::string > & | vecSrc, |
const std::string & | patern, | ||
const std::string & | replace | ||
) |
Replace a patern by an other in the input string in a vector of string.
vecSrc | : vector of input strings |
patern | : patern to be searched |
replace | : string which replace patern |
Definition at line 321 of file string_function.cpp.
References replaceStrInStr().
void replaceStrInStr | ( | std::string & | out, |
const std::string & | src, | ||
const std::map< std::string, std::string > & | mapReplace | ||
) |
Replace a map of string in a string.
[out] | out | : updated string |
src | : source string | |
mapReplace | : map of patterns (keys) and value to replace (values) |
Definition at line 358 of file string_function.cpp.
References replaceStrInStr().
void replaceStrInStr | ( | std::string & | out, |
const std::string & | src, | ||
const std::string & | patern, | ||
const std::string & | replace | ||
) |
Replace a patern by an other in the input string.
[out] | out | : output string |
src | : input string | |
patern | : patern to be searched | |
replace | : string which replace patern |
Definition at line 272 of file string_function.cpp.
Referenced by ArgParser::ArgParser(), replaceListStrInStr(), replaceStrInStr(), replaceVectorStrInStr(), testFindInListString(), testReplaceStrInStrMap(), and testStringFunction().
std::string replaceVectorStrInStr | ( | const std::string & | src, |
const std::vector< std::string > & | vecPatern, | ||
const std::string & | replace | ||
) |
Replace all the vector patern in the string srcDest by the replace string.
src | : source string |
vecPatern | : vector of the paterns we want to search |
replace | : string we want to replace |
Definition at line 387 of file string_function.cpp.
References replaceVectorStrInStr().
void replaceVectorStrInStr | ( | std::string & | srcDest, |
const std::vector< std::string > & | vecPatern, | ||
const std::string & | replace | ||
) |
Replace all the vector patern in the string srcDest by the replace string.
[out] | srcDest | : source and modified string |
vecPatern | : vector of the paterns we want to search | |
replace | : string we want to replace |
Definition at line 334 of file string_function.cpp.
References replaceStrInStr().
Referenced by checkReplaceVectorStrInStr(), and replaceVectorStrInStr().