PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
string_function.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __STRING_FUNCTION_H__
8 #define __STRING_FUNCTION_H__
9 
10 #include <string>
11 #include <vector>
12 #include <list>
13 #include <map>
14 
15 bool findInString(const std::string & str, char ch);
16 bool findCharsInString(const std::string & str, const std::string & chars);
17 
18 bool findInListString(const std::list<std::string> & listStr, const std::string & str);
19 bool findInVectorString(const std::vector<std::string> & vecStr, const std::string & str);
20 
21 
22 std::string eraseFirstCharsInStr(const std::string& str, const std::string & chars);
23 std::string eraseLastCharsInStr(const std::string& str, const std::string & chars);
24 std::string eraseFirstLastChars(const std::string& str, const std::string & chars);
25 std::vector<std::string> eraseFirstLastChars(const std::vector<std::string> & vecStr, const std::string & chars);
26 
27 size_t countNbChar(const std::string & str, char ch);
28 std::string eraseCharInStr(const std::string& str, char ch);
29 std::string eraseCharsInStr(const std::string& str, const std::string & rmchs);
30 
31 std::string replaceCharInStr(const std::string& str, char find, const std::string& replace);
32 std::string replaceCharsInStr(const std::string & str, const std::string & strFind, char replace);
33 size_t countStrInStr(const std::string & src, const std::string & patern);
34 void replaceStrInStr(std::string & out, const std::string & src, const std::string & patern, const std::string & replace);
35 std::string replaceStrInStr(const std::string & src, const std::string & patern, const std::string & replace);
36 std::vector<std::string> replaceStrInStr(const std::vector<std::string> & vecSrc, const std::string & patern, const std::string & replace);
37 
38 void replaceStrInStr(std::string & out, const std::string & src, const std::map<std::string, std::string> & mapReplace);
39 std::string replaceStrInStr(const std::string & src, const std::map<std::string, std::string> & mapReplace);
40 
41 void replaceVectorStrInStr(std::string & srcDest, const std::vector<std::string> & vecPatern, const std::string & replace);
42 void replaceListStrInStr(std::string & srcDest, const std::list<std::string> & listPatern, const std::string & replace);
43 std::string replaceVectorStrInStr(const std::string & src, const std::vector<std::string> & vecPatern, const std::string & replace);
44 std::string replaceListStrInStr(const std::string & src, const std::list<std::string> & vecPatern, const std::string & replace);
45 
46 std::string phoenix_escapeStr(const std::string & src, const std::string & strCharToEscape, const std::string & escapeStr);
47 
48 std::list<std::string> cutStringList(const std::string & str, char separator);
49 std::vector<std::string> cutStringVector(const std::string & str, char separator);
50 
51 std::list<std::string> cutStringOnSpacesList(const std::string& str);
52 std::vector<std::string> cutStringOnSpacesVector(const std::string& str);
53 
54 std::string copyStr(const std::string& str, long unsigned int begin, long unsigned int nbCh);
55 
56 bool isSameBegining(const std::string & str, const std::string & beginig);
57 
58 std::string phoenix_charToString(const char * ch);
59 std::string phoenix_getCommonBegining(const std::string & str1, const std::string & str2);
60 
61 #endif
62 
phoenix_escapeStr
std::string phoenix_escapeStr(const std::string &src, const std::string &strCharToEscape, const std::string &escapeStr)
Escape given string with passed characters.
Definition: string_function.cpp:411
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.
Definition: string_function.cpp:346
countNbChar
size_t countNbChar(const std::string &str, char ch)
Count number of chararacters ch in string.
Definition: string_function.cpp:145
findCharsInString
bool findCharsInString(const std::string &str, const std::string &chars)
Find multiple chars in a string.
Definition: string_function.cpp:29
replaceCharsInStr
std::string replaceCharsInStr(const std::string &str, const std::string &strFind, char replace)
Replace all char in the strFind by char replace.
Definition: string_function.cpp:205
countStrInStr
size_t countStrInStr(const std::string &src, const std::string &patern)
Count the number of patern in string.
Definition: string_function.cpp:237
cutStringOnSpacesVector
std::vector< std::string > cutStringOnSpacesVector(const std::string &str)
Cut a string on white characters ('&#92;t' ou ' ')
Definition: string_function.cpp:490
eraseCharInStr
std::string eraseCharInStr(const std::string &str, char ch)
copie la string str en effaçant le caractère ch
Definition: string_function.cpp:160
copyStr
std::string copyStr(const std::string &str, long unsigned int begin, long unsigned int nbCh)
Copy a string of nbCh starting from begin char.
Definition: string_function.cpp:515
phoenix_getCommonBegining
std::string phoenix_getCommonBegining(const std::string &str1, const std::string &str2)
Get the common begining between str1 and str2.
Definition: string_function.cpp:561
eraseLastCharsInStr
std::string eraseLastCharsInStr(const std::string &str, const std::string &chars)
Erase first and last char in a string.
Definition: string_function.cpp:97
cutStringVector
std::vector< std::string > cutStringVector(const std::string &str, char separator)
Cut a string the the given separator char.
Definition: string_function.cpp:448
findInString
bool findInString(const std::string &str, char ch)
Find a char in a string.
Definition: string_function.cpp:15
replaceCharInStr
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
Definition: string_function.cpp:220
eraseFirstLastChars
std::string eraseFirstLastChars(const std::string &str, const std::string &chars)
Erase first and last char in a string.
Definition: string_function.cpp:122
eraseCharsInStr
std::string eraseCharsInStr(const std::string &str, const std::string &rmchs)
copie la string str en effaçant les caractères rmchs
Definition: string_function.cpp:173
findInVectorString
bool findInVectorString(const std::vector< std::string > &vecStr, const std::string &str)
Find a string in a vector of string.
Definition: string_function.cpp:61
createReleaseCurl.str
str
Definition: createReleaseCurl.py:128
findInListString
bool findInListString(const std::list< std::string > &listStr, const std::string &str)
Find a string in a list of string.
Definition: string_function.cpp:45
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.
Definition: string_function.cpp:272
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.
Definition: string_function.cpp:334
cutStringList
std::list< std::string > cutStringList(const std::string &str, char separator)
Cut a string the the given separator char.
Definition: string_function.cpp:428
cutStringOnSpacesList
std::list< std::string > cutStringOnSpacesList(const std::string &str)
Cut a string on white characters ('&#92;t' ou ' ')
Definition: string_function.cpp:467
eraseFirstCharsInStr
std::string eraseFirstCharsInStr(const std::string &str, const std::string &chars)
Erase first char in a string.
Definition: string_function.cpp:77
isSameBegining
bool isSameBegining(const std::string &str, const std::string &beginig)
Check if two string start the same way.
Definition: string_function.cpp:531
phoenix_charToString
std::string phoenix_charToString(const char *ch)
Convert a char pointer into a string (event if the char pointer is NULL)
Definition: string_function.cpp:547