Commit 83a2201d authored by Nabil Chouika's avatar Nabil Chouika
Browse files

refs#16

In ElementaryUtils:
- Added string split function by string delimiter in StringUtils.

In PARTONS:
- Changed ObservableKinematic to use GenericType instead of fromStringToDouble.
- Some fix in DVCSConstantModel.

In PARTONs_Tests:
- Force C++98 in CMakeLists.
parent 77cb66a7
......@@ -108,6 +108,9 @@ public:
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);
/*!
* \fn static std::string vectorToString( std::vector<std::string> vector )
* \brief Transforme un vector de string en une chaine de caracteres
......
......@@ -258,6 +258,25 @@ std::vector<std::string> StringUtils::split(const std::string &chaine,
return strings;
}
std::vector<std::string> StringUtils::split(const std::string &chaine,
const std::string & splitSymbols) {
std::vector<std::string> strings;
int index = 0;
int size = splitSymbols.size();
for (unsigned int pos = 0; pos < chaine.size(); ++pos) {
if (chaine.substr(pos, size) == splitSymbols) {
strings.push_back(chaine.substr(index, pos - index));
pos += (size - 1);
index = pos + 1;
}
}
strings.push_back(chaine.substr(index, chaine.size() - index));
return strings;
}
std::string StringUtils::vectorToString(std::vector<std::string>* vector) {
std::string res = EMPTY;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment